mirror of
https://github.com/stablyai/orca.git
synced 2026-10-16 16:03:26 +00:00
perf: guard Linear comment footer async state without effect
This commit is contained in:
@@ -955,11 +955,10 @@ export function LinearIssueCommentFooter({
|
||||
const textareaRef = useRef<HTMLTextAreaElement>(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 (
|
||||
<div className="rounded-xl border border-border/70 bg-background shadow-xs">
|
||||
<div
|
||||
ref={handleFooterRef}
|
||||
className="rounded-xl border border-border/70 bg-background shadow-xs"
|
||||
>
|
||||
<textarea
|
||||
ref={textareaRef}
|
||||
value={body}
|
||||
@@ -1051,7 +1053,10 @@ export function LinearIssueCommentFooter({
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex items-end gap-2 border-t border-border/60 bg-background/40 px-4 py-3">
|
||||
<div
|
||||
ref={handleFooterRef}
|
||||
className="flex items-end gap-2 border-t border-border/60 bg-background/40 px-4 py-3"
|
||||
>
|
||||
<textarea
|
||||
ref={textareaRef}
|
||||
value={body}
|
||||
|
||||
Reference in New Issue
Block a user