[Bug]: React #185 infinite loop in ExpandedWorkGroupEntries (deterministic repro at 90%/110% zoom or constrained height) #47121
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/web
Steps to reproduce#
Related to #45997 (closed as could not reproduce) and #47106 (closed as duplicate of #45997). The bug is still present on main in apps/web/src/components/chat/TimelineWorkGroupRows.tsx (lines 263–274 and 327–331).
Root cause#
In ExpandedWorkGroupEntries:
maxHeightchanges by exactlyworkGroupOverflowAllowance(48px):calc(min(18rem, 50dvh) + ${expandedContentHeight + (fitsWithAllowance ? 48 : 0)}px)- The
useLayoutEffect(lines 263–274) depends on[fitsWithAllowance, updateScrollFades]and synchronously runs:setFitsWithAllowance(overflow <= (fitsWithAllowance ? 0 : 48))
Because the hysteresis threshold delta (48 - 0 = 48) equals the exact maxHeight delta (48px), there is 0px tolerance. Whenever clientHeight(fitsWithAllowance=true) - clientHeight(fitsWithAllowance=false) <= 47, both conditions evaluate to flip state simultaneously inside the same commit chain (true -> false -> true -> ... > 50 times), throwing React error #185.
Why #45997 did not reproduce at 100% zoom (DPR=1)#
In Chromium at DPR=1 with an unconstrained parent, clientHeight(true) - clientHeight(false) stays 48. However, it reproduces 100% deterministically in either of these conditions:
- Non-100% browser/Electron zoom (
90%or110%, i.e.Ctrl -/Ctrl +) + fractionalexpandedContentHeight:- Every
expandedContentHeightending in4.5, 9.5, 14.5, 19.5...(which occurs naturally becauseSimpleWorkEntryRowusestext-sm leading-relaxed-> fractional row heights) snaps physical pixels in Chromium such that:fitsWithAllowance = true(maxHeight = 18rem + 52.5px = 340.5px) ->clientHeight = 340fitsWithAllowance = false(maxHeight = 18rem + 4.5px = 292.5px) ->clientHeight = 293- Difference is
47pxinstead of48px.
- With content height
340.6px(scrollHeight = 341):true:overflow = 341 - 340 = 1 <= 0(false) ->setFitsWithAllowance(false)false:overflow = 341 - 293 = 48 <= 48(true) ->setFitsWithAllowance(true)- Synchronous infinite loop -> React Error #185.
- Every
- At 100% zoom (
DPR=1) if an ancestor caps height slightly belowmin(18rem, 50dvh) + 48px(e.g.330px), givingclientHeight(true) = 330vsclientHeight(false) = 288(delta = 42) andscrollHeight = 331(overflow = 1vs43).
Minimal deterministic repro (HTML + React 19 in Chromium at --force-device-scale-factor=1.1 or 0.9)#
function Repro() {
const ref = useRef(null);
const [fitsWithAllowance, setFitsWithAllowance] = useState(true);
const expandedContentHeight = 4.5; // fractional height from expanded entries
const workGroupOverflowAllowance = 48;
useLayoutEffect(() => {
const el = ref.current;
if (!el) return;
const overflow = el.scrollHeight - el.clientHeight;
setFitsWithAllowance(overflow <= (fitsWithAllowance ? 0 : workGroupOverflowAllowance));
}, [fitsWithAllowance]);
return (
<div
ref={ref}
style={{
overflowX: "hidden",
overflowY: "auto",
scrollbarGutter: "stable",
width: 500,
maxHeight: `calc(min(18rem, 50dvh) + ${
expandedContentHeight + (fitsWithAllowance ? workGroupOverflowAllowance : 0)
}px)`,
}}
>
<div style={{ height: "340.6px" }} />
</div>
);
}
Running the above in Chrome with --force-device-scale-factor=1.1 (or 0.9) against the bundled React 19.3.0 immediately throws Minified React error #185 with the exact same stack frames (Hi -> zi -> _c -> gc -> updateLayout -> useLayoutEffect -> Dl -> yu -> Ru -> yu).
Suggested fix#
Add a hysteresis margin (e.g. overflow <= (fitsWithAllowance ? 2 : workGroupOverflowAllowance - 2)), and/or guard against oscillating back to the previous state within the same layout pass (or Math.round(expandedContentHeight) + tolerance). Verified that adding a 1–2px margin (<= (fitsWithAllowance ? 1 : 47)) completely eliminates the crash in the repro above.
Expected behavior#
The tool-call list inside ExpandedWorkGroupEntries should settle stably without entering a synchronous useLayoutEffect state loop or crashing the thread timeline.
Actual behavior#
The renderer crashes with Minified React error #185 (Maximum update depth exceeded) while viewing an active thread timeline (ReadOnlyThreadTimeline / ExpandedWorkGroupEntries).
Impact#
Major degradation or frequent failure
Version or commit#
0.1.14-nightly.20261130.5479 (commit 9c5dea3b06f0; still present on main)
Environment#
Windows (1920x1080, 96 DPI), T3 Code (Nightly) Desktop App 0.1.14-nightly.20261130.5479, Codex (gpt-6.2-sol) on a linked remote environment
Logs or stack traces#
T3 Code (Nightly) 0.1.14-nightly.20261130.5479
Path: /<environmentId>/<threadId>
Time: 2026-12-01T23:11:14.125Z
Error: Minified React error #185; visit https://react.dev/errors/185 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at Hi (t3code://app/assets/client-D7xJT1KA.js:8:28288)
at zi (t3code://app/assets/client-D7xJT1KA.js:8:27813)
at _c (t3code://app/assets/client-D7xJT1KA.js:8:60299)
at gc (t3code://app/assets/client-D7xJT1KA.js:8:59921)
at t (t3code://app/assets/ReadOnlyThreadTimeline-CPZSJFx6.js:17:28376)
at F (t3code://app/assets/ReadOnlyThreadTimeline-CPZSJFx6.js:17:28396)
at Dl (t3code://app/assets/client-D7xJT1KA.js:8:94923)
at yu (t3code://app/assets/client-D7xJT1KA.js:8:104381)
at Ru (t3code://app/assets/client-D7xJT1KA.js:8:115603)
at yu (t3code://app/assets/client-D7xJT1KA.js:8:104368)
Workaround#
Reloading the T3 Code window / reopening the thread clears the crash (the background agent run is unaffected). Resetting zoom to 100% (Ctrl + 0) or slightly resizing the window avoids hitting the exact 1px rounding boundary.
Note: This bug report, root-cause investigation, and reproduction code were written by Antigravity (Gemini 4 Neon, High) running inside T3 Code.
tanstack-source added labelsbug
juliusmarminge closed this
Sign in to join this conversation.
New reproduction from a Linux desktop, same stack and same component. 2026-12-02.
Environment
mainat53bc5b5d17(betweenv0.1.13and0.1.14-nightly.20261130.5479), plus one local UI patch that auto-expands the latest reasoning and in-progress shell commands in the running turn, soexpandedContentHeightis non-zero without the reader expanding anything by hand.What happened
2026-12-02T00:40:18.929Zthe renderer crashed withMinified React error #185while an agent run was actively streaming in that thread (run started00:38:50Z, completed00:41:07Z; the thread had 22 command executions and 64 reasoning items).ReadOnlyThreadTimelinechunk are thefitsWithAllowancelayout effect inExpandedWorkGroupEntries:min(18rem, 50dvh) + 48pxband) rather than the fractional-zoom one.Happy to verify the suggested 1–2px hysteresis margin once it lands on
main.This comment was drafted with Qwen 3.8 27B running in OpenCode (T3 triage session).