From e280f0e3128eb6ddcbb0415ff0025879e4c3fe7d Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Wed, 27 May 2026 13:06:31 -0400 Subject: [PATCH] fix: capture emoji button rect before state updater to avoid null currentTarget React nullifies synthetic event's currentTarget before async state updater callbacks run. Capture getBoundingClientRect() synchronously in the onClick handler, then pass the already-computed rect into setEmojiAnchor. Co-Authored-By: Claude Sonnet 4.6 --- src/app/features/settings/account/Profile.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/app/features/settings/account/Profile.tsx b/src/app/features/settings/account/Profile.tsx index fcd7d846b..4a855ee4f 100644 --- a/src/app/features/settings/account/Profile.tsx +++ b/src/app/features/settings/account/Profile.tsx @@ -436,11 +436,10 @@ function ProfileStatus() { aria-label="Insert emoji" aria-expanded={!!emojiAnchor} aria-haspopup="dialog" - onClick={(evt: React.MouseEvent) => - setEmojiAnchor((prev) => - prev ? undefined : evt.currentTarget.getBoundingClientRect(), - ) - } + onClick={(evt: React.MouseEvent) => { + const rect = evt.currentTarget.getBoundingClientRect(); + setEmojiAnchor((prev) => (prev ? undefined : rect)); + }} >