Skip to content
TypeScript

perf(web): the composer banner stack compiles with the React Compiler (#20582)

Julius Marminge6b563bb75815
diff --git a/apps/web/src/components/chat/ComposerBannerStack.tsx b/apps/web/src/components/chat/ComposerBannerStack.tsx
index ccff4df8a03..a21d6581103 100644
--- a/apps/web/src/components/chat/ComposerBannerStack.tsx
+++ b/apps/web/src/components/chat/ComposerBannerStack.tsx
@@ -68,9 +68,10 @@ export function ComposerBannerStack({ className, items, attachedAbove }: Compose
};
}, []);
- useEffect(() => {
- if (items.length < 2) setStackExpanded(false);
- }, [items.length]);
+ // A stack that shrinks to one banner collapses, so the next stack starts collapsed.
+ if (items.length < 2 && stackExpanded) {
+ setStackExpanded(false);
+ }
useLayoutEffect(() => {
if (stackExpanded && pendingFocusRef.current === "notice") {