fix(web): resizing a pane no longer crashes an expanded tool list #48266
Opentris203(GitHub profile, opens in a new tab)wants to merge 2 commits into
main fromrefs/pull/48266/headopened View on GitHubtanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
- @@ -263,14 +272,12 @@272+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the list and its content on resize to set the height limit and scroll fades263273 useLayoutEffect(() => {264274 const element = listRef.current?.getScrollableNode();265275 if (!element) return;266- const updateLayout = () => {267- const overflow = element.scrollHeight - element.clientHeight;268- // Fractional zoom can round scrollHeight 1px above clientHeight on content that fits;269- // without this slack the allowance toggles on every layout pass.270- setFitsWithAllowance(overflow <= (fitsWithAllowance ? 1 : workGroupOverflowAllowance - 1));271- updateScrollFades();272- };273- updateLayout();274276 const content = element.firstElementChild;275277 return observeResize(content ? [element, content] : element, updateLayout);276- }, [fitsWithAllowance, updateScrollFades]);278+ }, [updateLayout]);279+ // Content can measure taller with the allowance than without it (rows rewrap as a pane280+ // resizes), so only a resize restores it; re-measuring right after dropping it would loop.281+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the list once the allowance it set has laid out282+ useLayoutEffect(() => {283+ if (fitsWithAllowance) updateLayout();
Pusheda2fe67a
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed