Skip to content
Source
Sign inSign up
pingdotgg/t3code

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 intomain fromrefs/pull/48266/headopened View on GitHub

Problem

Resizing the right panel while a thread shows an expanded tool-call group crashed the web app with Minified React error #185 (Maximum update depth exceeded). This is the crash in #47591, which still happens on builds that have the 1px slack from #47145 (seen on 0.1.14-nightly.20261203.5651). The stack's t / F frames in ReadOnlyThreadTimeline-*.js map, via a sourcemapped build of main, to the layout effect in ExpandedWorkGroupEntries (TimelineWorkGroupRows.tsx) at setFitsWithAllowance(...).

That effect depended on fitsWithAllowance and re-measured right after every toggle. The flag adds 48px to the box's max-height, so the overflow it reads moves with the value it sets. Whenever the content measures taller with the allowance than without it, each re-measure flips the flag back. That gives one nested update per commit until React throws. The thresholds only absorb a couple of pixels of difference.

Change

The effect is split in two:

  • The resize subscription measures fully, so a real resize of the list or its content can still add or drop the allowance.
  • The re-measure after a toggle runs only while the allowance is on. It can drop the allowance but never restore it, so a toggle can no longer undo itself within the same chain of commits.

A resize now settles after at most one toggle each way. A pass that ends where it started reports no new size to the ResizeObserver, so nothing schedules another measure. The 48px allowance and the 1px rounding slack behave as before.

Scope

Fixes the crash reported in #47591 (duplicates: #45997, #47106, #47121, #48093). #47594 was closed because its capped-box trigger wasn't shown to be the real one. This change doesn't depend on which layout causes the difference: it removes the feedback loop itself.

Verification

  • New browser test settles an expanded group that overflows only while it has the allowance (real Chromium) makes the group's content measure 2px over the box with the allowance and 40px over without it. On main it fails with "Maximum update depth exceeded". With this change it passes.
  • The repro test from factory/repro-47591 (466b9f58ac, a parent caps the group at 300px) also passes with this change. It fails on main according to #47591. I ran it locally and didn't commit it.
  • The existing #47145 1px-rounding test still passes, as do all 111 tests in MessagesTimeline.browser.test.tsx.
  • Not checked: a manual repro in the real app. I couldn't make a real layout oscillate with width sweeps or zoom from 1.1 to 1.25 in the browser tests, so the exact geometry from the right-panel resize is inferred. No visual change is intended, so there are no screenshots.

Claude Opus 5.5 via Claude Code in T3 Code.

    1. tanstack-source added labelsbug

    2. @@ -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 fades
      263273 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 pane
      280+ // 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 out
      282+ useLayoutEffect(() => {
      283+ if (fitsWithAllowance) updateLayout();
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium chat/TimelineWorkGroupRows.tsx:283

      When the allowance settles back to false, the bottom fade and fades.viewportHeight remain measured from the transient +workGroupOverflowAllowance layout. The effect calls updateScrollFades() before false commits, then skips it after the final height change, leaving shouldFollowWorkGroupAppend and maintainScrollAtEndThreshold with stale values. Call updateScrollFades() in the false branch without rerunning updateLayout().

      No longer relevant as of a2fe67a1191e9d46f51843d0b1bee0de91b056a0

      Note

      Claude Opus 5.5 responding on behalf of @tris203

      Fixed in a2fe67a1191e9d46f51843d0b1bee0de91b056a0. When the allowance is dropped, the post-toggle effect now calls updateScrollFades(), so the fades and viewportHeight come from the final layout. This matters in the bounce case: when a resize restores the allowance and it is then dropped again in the same chain, the box ends at the size the ResizeObserver last reported, so no later resize would correct them. The old code re-measured fades after every toggle, and this keeps that behavior.

      Sorry, I'm unable to act on this request because you do not have permissions within this repository.

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs Human Approval

      Macroscope's review found this PR requires human approval — The change stabilizes expanded tool-list resizing and refreshes scroll fades after layout changes. It also adds a lint-suppression directive for the new layout effect, which requires human review.

      Adjust the Minimum Blocking Severity for this repo — including turning it Off — in [Settings](https://app.macroscope.com/pingdotgg/settings#Repos). You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The list measurement callback is now stable. A layout effect remeasures while the height allowance fits and updates only scroll fades when it does not. A browser regression test covers an expanded tool group whose overflow measurement changes with the allowance.

      Changes: Tool group overflow measurement

      Layer / File(s)Summary
      Stable measurement and regression coverage
      apps/web/src/components/chat/TimelineWorkGroupRows.tsx, apps/web/src/components/chat/MessagesTimeline.browser.test.tsx
      A stable callback measures list overflow and updates scroll fades. A layout effect remeasures while the allowance fits; otherwise, it updates only scroll fades. The browser test checks that the expanded tool group settles without a maximum-update-depth error.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Suggested reviewers: yash-singh1, juliusmarminge

      Merge Risk: Minimal · up to a2fe6

      This change stops the crash that occurred when the right panel was resized with an expanded tool-call group. A regression test covers the scenario, and no merge-blocking risk was identified.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title "fix(web): resizing a pane no longer crashes an expanded tool list" matches the main change. The PR splits the layout effect in ExpandedWorkGroupEntries (TimelineWorkGroupRows.tsx) so a resi…
      Description checkPassedThe description follows the repository template closely. It has Problem, Change, Scope, and Verification sections, each with substantive content. The Problem section gives the error, the reproduction …
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Title check

      Explanation

      The title "fix(web): resizing a pane no longer crashes an expanded tool list" matches the main change. The PR splits the layout effect in ExpandedWorkGroupEntries (TimelineWorkGroupRows.tsx) so a resize no longer triggers a feedback loop of allowance toggles that causes React error #185 (Maximum update depth exceeded). The title is specific, follows conventional commit style, and names the affected area and the fixed symptom. It says "pane" where the description says "right panel", which is a minor wording difference and not a mismatch.

      Full details: Description check

      Explanation

      The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections, each with substantive content. The Problem section gives the error, the reproduction context, and the mechanism. The Change section explains the split effect and why it prevents the loop. The Scope section links related issues (#47591, #47145, and duplicates) and explains why the fix targets the feedback loop. The Verification section lists the new browser test, the repro test, the existing tests, and what was not checked, including the lack of a manual repro. Screenshots are not included, but the author explains that there is no visual change, which the template permits. The author also notes the agent model used, as the template asks.

      Finishing Touches

      Generate unit tests (beta)

      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between e37516fd0ba55d70dba2578b24580a0319b0cd3d and a2fe67a1191e9d46f51843d0b1bee0de91b056a0.

      Files selected for processing: 1

      • apps/web/src/components/chat/TimelineWorkGroupRows.tsx

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

    1. Pusheda2fe67a

Sign in to join this conversation.