diff --git a/apps/web/src/components/chat/ComposerBannerStack.tsx b/apps/web/src/components/chat/ComposerBannerStack.tsx index 4b42323aad..678c970fd2 100644 --- a/apps/web/src/components/chat/ComposerBannerStack.tsx +++ b/apps/web/src/components/chat/ComposerBannerStack.tsx @@ -43,14 +43,17 @@ export interface ComposerBannerStackItem { function useDismissTimeoutCleanup(timeoutRef: RefObject | null>) { useEffect(() => { - return () => { - if (timeoutRef.current) { - clearTimeout(timeoutRef.current); - } - }; + return () => clearDismissTimeout(timeoutRef); }, [timeoutRef]); } +function clearDismissTimeout(timeoutRef: RefObject | null>) { + const timeout = timeoutRef.current; + if (timeout) { + clearTimeout(timeout); + } +} + interface ComposerBannerStackProps { readonly className?: string; readonly items: ReadonlyArray;