diff --git a/static/app/components/core/input/inputGroup.tsx b/static/app/components/core/input/inputGroup.tsx index efb09245f5aa..73e6a97f6077 100644 --- a/static/app/components/core/input/inputGroup.tsx +++ b/static/app/components/core/input/inputGroup.tsx @@ -213,8 +213,15 @@ function LeadingItems({children, disablePointerEvents, ...props}: InputItemsProp if (!ref.current) { return; } - setLeadingWidth?.(ref.current.offsetWidth); - }, [children, setLeadingWidth, size]); + const el = ref.current; + const observer = new ResizeObserver(() => { + if (el) { + setLeadingWidth?.(el.offsetWidth); + } + }); + observer.observe(el); + return () => observer.disconnect(); + }, [setLeadingWidth]); return ( { + if (el) { + setTrailingWidth?.(el.offsetWidth); + } + }); + observer.observe(el); + return () => observer.disconnect(); + }, [setTrailingWidth]); return (