From a4bd225722d7aa4155d38cdc6ba6e0be4a7d2be3 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sat, 30 May 2026 02:00:23 -0700 Subject: [PATCH] perf: guard Linear comment footer async state without effect --- .../src/components/LinearItemDrawer.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/renderer/src/components/LinearItemDrawer.tsx b/src/renderer/src/components/LinearItemDrawer.tsx index 0e8e99e7585..e8dc2c36d7e 100644 --- a/src/renderer/src/components/LinearItemDrawer.tsx +++ b/src/renderer/src/components/LinearItemDrawer.tsx @@ -955,11 +955,10 @@ export function LinearIssueCommentFooter({ const textareaRef = useRef(null) const mountedRef = useRef(true) - useEffect(() => { - mountedRef.current = true - return () => { - mountedRef.current = false - } + const handleFooterRef = useCallback((node: HTMLDivElement | null): void => { + // Why: comment submission can resolve after the footer unmounts; the root + // ref keeps that completion from writing stale local state without an Effect. + mountedRef.current = node !== null }, []) const autoGrow = useCallback(() => { @@ -1016,7 +1015,10 @@ export function LinearIssueCommentFooter({ if (variant === 'linear-page') { return ( -
+