Repository navigation
Conversation
nwparker
force-pushed
the
crash/s59-statusbar-185
branch
from
November 3, 2026 06:01
8ebacd8 to
b29038b
Compare
…en measurements drift The density hook re-measures each level in a layout effect and treated any >1px natural-width difference at a level as a content change, wiping every level and re-probing from the roomiest one. When a collapsed (out-of-flow) usage chip measures off its in-row width, level 3 alternates between its collapsed and uncollapsed measurement forever, chaining synchronous layout-effect updates until React throws #185 (max update depth) from StatusBar. - Only compare widths measured under the same collapsed set. - Bound consecutive self-caused updates per settle pass as a backstop.
…ant and converge - Remember each chip's in-row width (per density level and DPR) and use it for collapsed chips, so collapsing never reads as a content change. Drops the collapsed-key comparison blind spot from the previous commit. - Keep a fitting collapsed set until the available width or row content changes. - When the settle budget runs out, fall back to the tightest level with calm chips collapsed and console.warn so the drift can be diagnosed. - Tests: drift-free exact outcomes, content change during a collapse, budget exhaustion ends in a fitting state, resolveUsageChipWidth unit tests.
…he density fallback sticky - The kept collapsed set now also depends on each chip's urgency, so a folded chip that turns urgent is pinned back into the row at the same width. - Once the settle budget runs out, the bar stays on the fallback layout until the available width, the row's natural width or a chip's urgency changes, instead of re-running a 15-commit probe on every outside re-render. The warning is logged once per bar.
nwparker
force-pushed
the
crash/s59-statusbar-185
branch
from
November 3, 2026 06:10
b29038b to
a49de95
Compare
Contributor
|
Holding this back from merge: the width drift has been reproduced only in the mocked layout model, and real Chromium measured 0px drift. The fix limits the update loop ( |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
Do not merge — the bug this fixes hasn't been reproduced outside a mocked layout. Reviewed during the crash-PR scan, which merged the 9 related PRs, and held back:
MAX_SETTLE_UPDATES, a cap on updates. When the cap is hit, the bar falls back to a fixed layout that can be more cramped or more collapsed than it needs to be. The chip-width cache and collapse-tracking logic target the modeled drift only.Needed to unblock: reproduce the drift in a real browser (actual chip CSS, a fractional display scale, the reporter's providers and language), then fix the measurement so collapsed chips measure the same as in-row chips, rather than limiting updates.
Description
From the Scan-59 crash report: on macOS v1.4.243, React error #185 ("Maximum update depth exceeded") is thrown from
StatusBar. De-minifyingStatusBar-C_hs5yr5.jsputs the throwing setState atsetLevel(nextLevel)insideevaluate()inuseStatusBarDensity(src/renderer/src/components/status-bar/status-bar-density.ts), run from its no-depsuseLayoutEffect. The breadcrumb (pendingLanes=2 SyncLane, storeWrites=0) fits a chain of layout-effect setStates, not a zustand selector. This is separate from the CombinedDiffViewer loop in #31552.How the loop can happen
recordStatusBarDensityWidthtreats a natural-width change over 1px at a level as a content change and wipes every recorded level.invisible absolute).Fix (
status-bar-density.ts,status-bar-usage-collapse.ts)resolveUsageChipWidth) andmeasureUsageRowuses it for collapsed chips.naturalWidth,pinnedWidthandpickCollapsedUsageChipstherefore see the same widths whatever is collapsed. The memo is reset when the density level ordevicePixelRatiochanges. If a collapsed chip's out-of-flow width changes after it collapsed (its content changed), its memo is dropped and the measured width is used.main.MAX_SETTLE_UPDATES= levels × 3 = 15 self-caused updates per settle pass (a pass resets on a render the hook did not cause, an available-width change, or an evaluation that changes nothing). If it runs out, the bar goes to the tightest level with every calm chip collapsed, syncsoverflowingonce more, and logsconsole.warn('[status-bar] density did not settle within 15 updates; using the tightest layout')(once per bar, so persistent drift cannot spam the log).The first commit's "only compare widths measured under the same collapsed set" check is gone. With collapse-invariant measurement it is no longer needed, and it had a blind spot: a real content change in the same render as a collapse change did not invalidate stale roomier levels.
Fix evidence
Tests (happy-dom with a layout model: 5 chips, 220px bar):
status-bar-density.layout-loop.test.tsxgemini, grok, kimicollapsed, and the rendered row fits. Going 1000px to 220px lands on the same state. These pass onorigin/maintoo, which shows the budget and memo don't change the outcome when there is no drift.codex, gemini, grok) so the urgent chip is visible. This passes onmain; it fails on the previous PR head, which kept the stale set.main.status-bar-usage-collapse.test.ts: unit tests forresolveUsageChipWidth(remembered width while collapsed, a content change while collapsed, a chip never seen in the row).origin/mainChecks:
pnpm test src/renderer/src/components/status-bar/ --maxWorkers=2reportsTest Files 68 passed (68), Tests 629 passed (629).oxlintandoxfmt --checkare clean on the changed files.Real-layout evidence (and its limits)
I could not get collapsed chips to measure differently from their in-row width in real Chromium. A headless Chromium scratch page copied the status-bar usage row CSS (relative
whitespace-nowrapbar,overflow-clipcluster,shrink-0usage row,inline-flex gap-3button,inline-flexchips that turninvisible absolutewhen collapsed, and the "+N" chip). It measured each chip in row and with 1 to 5 chips collapsed, and checked the row's computed natural width, at device scale factors 1, 1.25, 1.5, 1.75 and 2 and bar widths from 120 to 700px. The difference was 0.000px in every case, both per chip and for the natural width. The only drift came from applying CSSzoomto the root:getComputedStylegaps stay unzoomed while rects are zoomed, which breaks the natural-width sum by up to about 16px. Orca uses Electron page zoom, not CSSzoom, on the status bar, so that is not shown to be the user's trigger.So the drift cases in the tests are models, not reproductions. They show the hook can no longer loop for any per-chip collapse drift and is bounded for anything else. They do not show what drifted on the reporter's machine.
What this does NOT fix / trade-offs
ELI5
The status bar tries each layout, roomiest to tightest, until one fits. When it folded away some usage chips, the folded chips could measure a little differently, so the bar thought its content had changed and started over, forever, until React crashed. Now the bar remembers how wide each chip was while it was visible and uses that number while it's folded, so folding never looks like a content change. Once a folded layout fits, it stays put until the window or the content actually changes. As a last resort, if it still can't settle after 15 tries, it picks the tightest layout and logs a warning.