Skip to content

fix: improve scrollbar and file explorer scroll behavior - #185

Merged
AmethystLiang merged 1 commit into
mainfrom
fix-scrollling
Mar 29, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
fix-scrollling

Conversation

@AmethystLiang

Copy link
Copy Markdown
Contributor

Summary

  • Restyle scrollbar to VS Code-like always-visible appearance using color-mix with proper hover/active states
  • Fix background shorthand resetting background-clip: padding-box in scrollbar thumb pseudo-states
  • Add wheel capture handler in file explorer to prevent draggable file items from swallowing scroll events
  • Fix flex overflow on scroll container (h-full min-h-0)
  • Restrict drag to file items only (not directories)

Test plan

  • Verify scrollbar is visible and has correct VS Code-like styling (thin inset thumb)
  • Hover/click scrollbar thumb and confirm visual feedback (opacity change)
  • Scroll file explorer with many files — ensure smooth scrolling even when cursor is over draggable items
  • Drag a file from explorer to editor — confirm drag still works
  • Confirm directories are not draggable

…onflict

- Switch scrollbar to VS Code-like always-visible style with proper
  hover/active states using color-mix
- Use background-color instead of background shorthand in scrollbar
  pseudo-states to preserve background-clip: padding-box
- Add wheel capture handler to prevent draggable items from eating
  scroll events in file explorer
- Fix flex overflow with h-full min-h-0 on scroll container
- Only allow file items (not directories) to be draggable
@AmethystLiang
AmethystLiang merged commit 666c290 into main Mar 29, 2026
1 check passed
nwparker added a commit that referenced this pull request Jul 14, 2026
#185 ref loop

radix-ui 1.4.3 bundles pre-fix sub-packages (react-slot 1.2.3, react-popper
1.2.8, react-compose-refs 1.1.2, react-menu/dropdown-menu 2.1.16) that build a
new composed callback-ref identity every render. Under React 19's re-run-on-
identity-change ref semantics, that detaches/re-attaches the ref each commit;
several primitives compose a useState setter as that ref (Tooltip
onTriggerChange, Popper onAnchorChange), so the state oscillates null<->node
and after >50 nested updates React throws #185 (Maximum update depth exceeded).
Crash e95669d2 (Tooltip->Button) and the dev DropdownMenu->Button reports.

1.6.2 bundles the fixed sub-packages (react-slot 1.3.0 memoized compose-refs,
react-popper 1.3.3, react-compose-refs 1.1.3, react-menu/dropdown-menu 2.1.20,
react-tooltip 1.2.12). Upstream radix-ui/primitives #3799 + #3963.

Also batches React-runtime patch bumps (in-range 19.2.x, low risk):
react/react-dom 19.2.5->19.2.7, @types/react 19.2.14->19.2.17.

Evidence: Orca's real Tooltip+Button tree fires the button ref 2 attaches + 1
detach on a static mount with 1.4.3 (churn), and 1 attach + 0 detach with 1.6.2
(stable). Renderer suite (13703 tests) + web typecheck green on the combined bump.

Co-authored-by: Orca <help@stably.ai>
nwparker added a commit that referenced this pull request Jul 14, 2026
…185 ref loop (crash e95669d2) (#8679)

Co-authored-by: Orca <help@stably.ai>
brennanb2025 added a commit that referenced this pull request Jul 20, 2026
…-render churn (#9615)

The UsagePercentageDisplayChangeNotice callout re-measures its fixed anchor
on every ResizeObserver/resize delivery and calls setAnchorPosition with a
fresh object each time. Equal-geometry deliveries (the common case) still
churned a re-render apiece because the object identity changed.

Bail when bottom/left are unchanged so React short-circuits before commit.
Measured: 20 identical-geometry deliveries → 20 re-renders before, 1 after.

This is defensive robustness/perf hardening for the status-bar subtree that
surfaced in crash f75ed81b (React #185 in overlay.status-bar). It is NOT a
proven fix for that crash — the reproduced #185 loop lives in radix Popper
internals and is not unit-reproducible; this removes one churn source feeding
that subtree.
Rast53 pushed a commit to Rast53/orca that referenced this pull request Jul 22, 2026
Returning a fresh object from the useAppStore selector re-triggered
useDetectedAgents effects every render and hit React stablyai#185 (max update
depth) in QuickLaunchAgentMenuItemsInner.

Match TabBar: select a stable string key, then memoize the target object.
nwparker pushed a commit that referenced this pull request Jul 23, 2026
…React #185)

The TerminalOverlaySlot fallback-measurement path (Windows/Chromium without
full CSS anchor-size support) installed a ResizeObserver whose callback wrote a
brand-new measuredFallbackRect object on every tick with no equality guard. A
stable geometry therefore still "changed" state each measurement, re-running the
second layout effect -> SYNC_FIT_PANES_EVENT -> xterm fit() -> resize -> observe
-> repeat: an unbounded measure<->fit loop that crashed with React #185
("Maximum update depth exceeded"). macOS takes the CSS-anchor path where the
measuring effect early-returns, which is why it never crashed.

Round measured top/left/width/height to integers (kills sub-pixel jitter) and
return the previous state reference on an unchanged rect so React bails out and
the loop settles. Also guard the null-reset branch to only commit when prev is
not already null. Genuine geometry changes are unaffected.

Adds a happy-dom regression test that forces the fallback path and drives the
ResizeObserver with a constant rect: buggy HEAD re-renders once per tick
(unbounded), the fix settles at zero.

Reports: Windows, Orca 1.4.148/1.4.149, boundary terminal.workbench, React #185
(f1783c09 / 5ff8a4e6 / 52aabedb).
nwparker added a commit that referenced this pull request Jul 23, 2026
VoicePane created a fresh fallback on every render when settings.voice was absent, changing effect dependencies and repeatedly issuing speech IPC and model-state refreshes. Keep a per-pane lazy default with stable identity and cover the behavior in the existing VoicePane suite.

Fixes crash reports 7f93d89c (macOS) and 362b566d (Windows).
nwparker added a commit that referenced this pull request Jul 23, 2026
AmethystLiang added a commit that referenced this pull request Jul 26, 2026
…ty (#10632)

Preserve object identity in pane-title overlay rect state to fix infinite
re-renders. A fresh {} literal creates a new reference on every call, causing
React to treat the state as changed even when logically equivalent, triggering
the layout effect to continuously re-measure and re-set state (React #185).

Add cold-park verdict flip telemetry to diagnose crash cluster C5: records
whether parking state churns in the field for next crash bundle analysis.

Document that AddressPicker crash (cluster C6) originates in radix-ui's
SelectItem unmount cleanup, not in our component code.
nwparker added a commit that referenced this pull request Jul 29, 2026
… (#11326)

* fix(activity): bound Activity portal readiness oscillation (React #185)

React error #185 is "Maximum update depth exceeded" -- an unbounded render loop,
not setState-after-unmount as the crash reports superficially suggest. Verified in
react-dom@19.2.7's production bundle: getRootForUpdatedFiber throws
Error(formatProdErrorMessage(185)) when 50 < nestedUpdateCount. That frame is the
top of all 14 crash stacks across shipped 1.4.156 / 1.4.158 / 1.4.159.

nestedUpdateCount and rootWithNestedUpdates are module-level globals keyed on the
ROOT, not on a component. One runaway loop saturates the counter and the throw
lands on whichever fiber calls setState next, so SortableTab (terminal.workbench),
the Radix Presence/MenuPortal (page.settings) and the sidebar.worktrees button are
innocent bystanders with misleading component stacks -- four boundaries, one bug.

The driver is Activity's portal readiness pass. When 'ready' is unreachable while
'unavailable' stays reachable, updateReadiness flips loading<->unavailable from
inside useLayoutEffect -- React's sync lane, the lane that increments
nestedUpdateCount -- so it saturates and throws rather than merely being slow. A
prior investigation captured this live on Windows via CDP at 239 renders in 847ms.

Bound the oscillation: after ACTIVITY_PORTAL_READINESS_MAX_FLIPS consecutive
loading<->unavailable transitions the latch parks on 'unavailable' until a real
'ready' arrives. The latch rewrites only the hook's output, never the DOM probe,
so a terminal that churns during a slow attach and then genuinely comes up still
releases it. Because the counter is global per root, this also protects every
innocent bystander in the app -- most of the user-visible value.

Extract reconcileActivityPortalThreads and resolveActivityPortalSwap so the portal
loop is testable against the real collaborators. Note the reconciliation keeps its
worktree+tab comparison deliberately: Terminal mounts one TerminalPane per
(worktree, tab) and routes it by worktree+tab, so staging a same-tab pane would
leave the staged slot empty and its readiness stuck on 'loading' forever. Same-tab
switches swap in place via isolatedPaneKey instead.

Co-authored-by: Orca <help@stably.ai>

* fix(activity): coalesce portal readiness updates

* test(activity): tighten readiness regression coverage

---------

Co-authored-by: Orca <help@stably.ai>
nwparker added a commit that referenced this pull request Aug 1, 2026
…the guard

Three comments said `false` is the verdict that matters because it is the
only one showing the activation could not converge. That is backwards.
The repair effect activates a tab drawn from tabsByWorktree[active], so
the React #185 path can only ever emit `true`; `false` is what a
deliberate jump-to-agent into a background worktree emits from a fully
converged state. A reader of the next bundle would have discarded the
exact sample the breadcrumb exists to capture.

The mechanism was right, only its stated reason was wrong: the real
justification for keying on the verdict is symmetric, since coalescing
keeps only the newest payload and either verdict would erase the other.

The suite also did not pin the "at most 2 per tab id" bound - a guard
keyed on `${tabId}:${activeWorktreeId}` passed all 11 tests while
emitting once per worktree, the storm the guard exists to prevent. Adds
a count-pinning test that kills it.

Caps the never-pruned guard set at 256 distinct verdict keys (~85KB),
mirroring MAX_COALESCE_KEYS. Measured 330 B/entry; a realistic thousand
duplicated tab ids is ~0.6MB, negligible but unbounded in principle.
nwparker added a commit that referenced this pull request Aug 1, 2026
…hurning the renderer

Adversarial round 1 found the renderer-side stabilisation was inert during a real
download. The progress fan-out already coalesces to whole percent, but the renderer
discards the event payload and re-polls getModelStates, and getModelState returned
the cached downloading state verbatim - raw sub-percent progress. So every chunk
produced a fresh object, resolveModelStates never matched, and all the real benefit
came from the main-side coalescing alone.

Quantise the polled reply to the precision the UI already renders
(Math.round(progress * 100)), keeping the stored cache exact.

Also from round 1:
- the whole-status dedup swallowed downloadModel's already-downloaded branch, whose
  lone 'ready' is the only notification the requesting window ever gets - a dead
  click and a permanently stale pane with two windows open. Gate it on
  downloading -> downloading so every one-shot transition stays unconditional.
- rename the storm test off '.react185.': it counts renders and asserts nothing
  about #185, and #185 could not be reproduced at IPC-realistic pacing.
OrcaWin pushed a commit that referenced this pull request Sep 15, 2026
…able

One lookbehind in the path redactor fails in opposite directions on the two
shapes a `file://` URL can take, and both failures reached the field.

`PATH_PATTERNS` rule 5 is `(?<![A-Za-z0-9./])\/[A-Za-z0-9._-]+\/…`. Its
lookbehind rejects a slash preceded by a slash.

  - On POSIX a frame reads `file:///Users/alice/…`. The path's own leading slash
    sits behind the scheme's third slash, so the rule never fires and NOTHING is
    redacted — the account name and full filesystem layout ship in the report.

  - On Windows the same frame reads `file:///C:/Users/alice/…`. The drive letter
    interposes, the leading slash is preceded by `:`, the rule fires, and it
    takes the frame WHOLE — asset filename and `:line:col` included. Those
    offsets are the only axis a minified stack can be clustered on.

Measured over the corpus: of 17 minified React #185 stacks, all 13 darwin/linux
kept every offset (130/130 frames) and all 4 win32 lost every one (0/40 frames).
Every win32 frame reads `at _i (file:///C:[redacted-path])`.

So: a `file://` rule that redacts the URL whatever follows the scheme, quoted
form first so a URL holding spaces is taken whole rather than truncated at the
first one; and ahead of it a rule that keeps a BUILD ASSET's name and offset
while replacing the directory.

WHY THE ASSET MUST CARRY A CONTENT HASH

A first revision of this gated on "ends in .js and has an offset". Review showed
that is a property no user file is prevented from having, and fuzzing the
grammar found 13,650 inputs where it preserved a basename the old code redacted
— `bob-divorce-settlement.js:3:9`, `alice.smith-acme-payroll-2025.js:1:1`,
private package and chunk names, with no length cap on what survived.

The gate is now the bundler's own output shape: a final `-` segment of exactly
8 base64url characters holding at least one digit, underscore, or capital.
Against every asset name appearing in a field stack (153 distinct) it keeps 152
and drops only the unhashed `index.js`; against document-shaped names it keeps
none. Anything else stays fully redacted.

It also no longer anchors on an arbitrary `scheme://`. Doing so ate the host of
an `https://…/app-HASH.js:1:2` frame and mangled `webpack://` and
`chrome-extension://` module paths, which are the triage axis for those frames
and carry no machine identity.

EVIDENCE

Replaying real shipped frames through the new sanitizer:

  before  file:///home/<name>/src/<name>/orca/out/renderer/assets/client-CXJwj0PF.js:8:27510
  after   [redacted-path]/client-CXJwj0PF.js:8:27510

  before  file:///C:[redacted-path]              (what Windows ships today)
  after   [redacted-path]/Terminal-CHo8p2a1.js:1:7269

The five offsets that survive on that first stack — 27510, 27083, 52218, 52047,
91686 — are exactly the recurring throw shape this family is triaged by.

TRADE-OFFS AND KNOWN RESIDUALS

- Windows frames get LONGER, not shorter: about 42% per frame, because the old
  rule collapsed the whole frame. At today's 8000-char IPC cap this does not
  bite (64 frames kept either way), but output-budget headroom drops from 63%
  to 89%. Raising that cap would silently cost Windows stacks roughly 30% of
  their deepest frames.
- A username inside a build-asset-shaped name (`alice-CHo8p2a1.js`) would still
  survive. Contrived for Orca's own bundles; stated rather than hidden.
- The regex is quadratic on adversarial input, not exponential. Worst shape
  found costs 140ms at 16000 chars; a real minified stack of the same size costs
  0.2ms. Callers clamp stacks to 8000 and notes to 16000, so the ceiling today
  is ~140ms of synchronous work per report. The bound comes from the callers,
  not the regex.
- NOT fixed, pre-existing, and confirmed in the field: a Vite dev-server frame
  (`http://localhost:5173/@fs/Users/<name>/…`) ships the account name and this
  change does not see it — the `?v=` query breaks the offset anchor and `.tsx`
  is outside the asset class. One corpus payload leaks a name 13 times this way.
  Also unhandled: `file://localhost/…` and `file://host/share/…` authority forms.
- NOT fixed, pre-existing: an UNQUOTED URL containing a literal space stops at
  the space. Worst case is worse than a benign tail — a Windows profile folder
  derived from a domain display name leaves surname and employer
  (`[redacted-path] Smith/AppData/…`). Quoted URLs holding spaces are now taken
  whole, which is new.

Corpus notes for anyone rechecking these numbers: 326 raw payload files but 324
distinct reports (one byte-identical pair, one same-report-ID pair). The "19
#185" figure needs the unminified `Maximum update depth exceeded` form counted
too; the minified marker alone gives 17. Three payloads carry a real account
name, not two — the third is the `/@fs/` shape above, which a `file://`-anchored
scan cannot see.

No test covered a `file://` URL at all, which is how both directions shipped.
There are now 49 in this file, including a per-platform frame case for darwin,
linux, win32 URL and win32 backslash, six document-shaped fixtures that all
carry a real offset, and four cases pinning the schemes that must stay untouched.
OrcaWin pushed a commit that referenced this pull request Sep 15, 2026
One lookbehind in the path redactor fails in opposite directions on the two
shapes a `file://` URL can take.

`PATH_PATTERNS` rule 5 is `(?<![A-Za-z0-9./])\/[A-Za-z0-9._-]+\/…`. Its
lookbehind rejects a slash preceded by a slash.

  - On POSIX a frame reads `file:///Users/alice/…`. The path's own leading slash
    sits behind the scheme's third slash, so the rule never fires and NOTHING is
    redacted — the account name and full filesystem layout ship in the report.

  - On Windows the same frame reads `file:///C:/Users/alice/…`. The drive letter
    interposes, the leading slash is preceded by `:`, and the rule fires.

So Windows file URLs were redacted and POSIX ones were not. Three payloads in a 326-file corpus carry a real account name: 25 occurrences,
13, and one with 48 path prefixes holding the name twice each — 96 literal
occurrences of a developer's account in a single submitted report, via
`/home/<name>/src/<name>/`.

Replaying those three payloads' actual leaking lines through both versions:
134 account-name occurrences before, 13 after. The 13 are payload C, whose
vector is a Vite dev-server URL this change does not address (below).

This adds two rules at the head of `PATH_PATTERNS`: a quoted `file://` URL, then
an unquoted one. Quoted first, so a URL holding spaces is taken whole rather
than truncated at the first one — that case previously leaked the entire path.

WHAT THIS DELIBERATELY DOES NOT DO

An earlier revision also preserved a stack frame's asset name and `:line:col`
while redacting its directory, because those offsets are the only axis a
minified React stack can be clustered on, and Windows loses all of them: across
17 minified React #185 payloads, darwin and linux kept 130 of 130 frames and
win32 kept 0 of 40.

That half is withdrawn. Gating on "ends in .js with a line and column" preserved
the basename of any user file with that shape. Gating instead on "carries a
bundler content hash" only narrowed it, because the shape it actually tests is
"the last 8 characters are not all lowercase letters" — which admits YYYYMMDD
dates, `_v2` suffixes, and every capitalised eight-letter dictionary word.
A grammar fuzz found 691,200 inputs where a user-identifying basename survived
the new code and did not survive the old, including
`tax-return-20241231.js` and `therapy-journal-20250101.js`. Against 5,000
ordinary basenames from this repo's node_modules, 99.3% become gate-passing once
one common date or version suffix is appended.

Two further defects went with it: running the frame pass first destroyed the
quoted-path rules' anchor, so a quoted region beginning with a frame fell
through to the unquoted rules and leaked from the first space onward; and its
two lookaheads made the regex quadratic on adversarial input — 4.1s at 50k
chars, 64s at 200k, on the unclamped breadcrumb path in the main process. With
the pass removed, 100k chars of the worst shape cost 0.10ms.

Preserving build frames is worth doing and needs a gate that constrains the
whole basename rather than its last 8 characters. It is not worth rushing into
the code path that decides what leaves a user's machine.

COST, STATED PLAINLY — AND IT IS SMALLER THAN IT FIRST LOOKS

darwin and linux stacks lose the frame `:line:col` offsets they currently keep,
because they were only keeping them by not being redacted at all. Windows is
byte-identical — it already lost them.

What survives on every platform: all 62 frame lines of an 8000-char stack, the
complete ordered minified function-name sequence (`_i, Ac, zv, Ll, kt, …`), the
component-stack component names, and `boundary_id` / `surface`. The function-name
sequence is the primary fingerprint crash aggregators group on; `line:col` is
the build-specific, weaker key. So these reports do not become unclusterable.

And redaction shortens the output enough to escape the 4000-char stack cap that
was silently truncating these. Measured on five real payloads (4 darwin, 1
linux) that previously shipped at exactly 4003 chars — the truncation marker:
they now ship at 899 / 1428 / 1476 / 1476 / 1499 chars, untruncated, with the
minified function-name sequence identical to the input in all five. Frame counts
come out equal rather than higher (37/37, 56/56, 57/57), because every over-cap
stack in the corpus is already one of the old code's truncated artifacts, so its
pre-truncation frame count is unrecoverable. The headroom gain is real and
measured; a frame-count gain is plausible but not demonstrable from this corpus.

A follow-up worth doing, and measured: preserving the `:line:col` alone — with
no basename — would restore the offset axis on every platform with no leak
surface at all, since digits carry nothing. Of the 17 payloads whose error_stack
holds the minified #185 string, 13 still carry offsets, and clustering those on
the INNERMOST THREE frames gives exactly 2 shapes (8 and 5). Stated precisely
because it matters: the full ordered offset sequence gives 9 clusters, since
outer frames drift per React build and the app-bundle frame moves every release.
The innermost frames are the stable part.

RESIDUALS — ONE OF THEM NEW

  - A Vite dev-server frame `http://localhost:5173/@fs/Users/<name>/…` still
    ships the account name. Not the `?v=` query or the `.tsx` extension, as an
    earlier draft of this message claimed: nothing anchors inside an `http://`
    URL at all, because every separator in `/@fs/Users/` is preceded by an
    alphanumeric. One corpus payload leaks a name 13 times this way.
  - `~user/…`, `.../Users/…` and `webpack:///Users/…` are unhandled.
  - An UNQUOTED path containing a literal space still stops at the space. Worst
    case is a Windows profile folder from a domain display name, leaving surname
    and employer. Quoted `file://` URLs holding spaces are now taken whole,
    which is new.
  - NEW, and the one thing here that is not pre-existing: redaction happens
    BEFORE truncation, so collapsing a long `file://` URL to `[redacted-path]`
    makes room under the length cap for content that previously fell past it. In
    a constructed dev-mode stack mixing `file://` frames with `/@fs/` frames, the
    old output truncated away all ten `/@fs/` frames and the new one ships all
    ten. Net leakage falls in every case measured this way (37→10, 34→10, 30→10,
    20→10 name occurrences) — but that does not generalise: a constructed input
    whose old output was name-sparse and whose newly-reachable tail is name-dense
    can raise the count, worst observed 5→515. Nothing newly exposed is content
    the old code redacted; it is unredacted residual whose reachability
    increased. No corpus payload contains both shapes.
  - Diagnostic BUNDLES, as opposed to crash payloads, are not sanitized by this
    code at all: roughly 274-282 of 321 expose 210-212 distinct home-directory
    usernames across some 800,000 occurrences (the range is definition-sensitive). That is a separate pipeline, and roughly four orders of
    magnitude larger than the payload leak this commit fixes.

No test covered a `file://` URL, which is how this shipped. There are now 49 in
this file: a per-platform frame case for darwin, linux, win32 URL and win32
backslash; nine document-shaped fixtures, each carrying a real `:line:col`, kept
so a future attempt to preserve frames has to clear the counterexamples that
killed this one; and three pinning the properties review found load-bearing but
untested — the `i` flag (an uppercase scheme was previously redacted by nothing
at all), the rule's inability to cross a newline, and quote-adjacency, which is
what stops it stealing an opening quote the way the withdrawn revision did.

One change post-dates the final review round and carries a round less scrutiny
than the rest: the unquoted rule was `file:\/\/\/?(?:[A-Za-z]:)?[\\/]…`, which
required a separator where an authority can appear, so `file://localhost/…`,
`file://host/share/…` and `file://Users/…` escaped every rule in the list. A
test added for those found it. It now takes everything after the scheme, which
is strictly more redaction; the `+` keeps the bare token in prose intact, and a
replay of all 31,497 payload lines leaves the same 13 residual account-name
prefixes, all Vite.

Review: four rounds. Round 1 found the frame pass preserved any `.js` basename;
round 2 found the hash gate meant to fix that was really a "last 8 characters are
not all lowercase" gate, with 691,200 leaking fuzz cases, and that the pass also
broke the quoted rules' anchor and made the regex quadratic. Removing the pass
was round 2's own recommendation. Round 3 fuzzed the remainder against the
pre-commit baseline over 604,800 grammar cases and 272,571 realistic cases and
found zero regressions, confirmed the anchor break is structurally impossible for
these two rules, and measured the worst adversarial shape at 2.9ms per 200k
chars against the removed pass's 64 seconds.
OrcaWin added a commit that referenced this pull request Oct 2, 2026
#185 during worktree removal (#23636)

* fix(terminal): stop parking pass queueing no-op renders during pane-close bursts

Removing an active worktree with many terminal panes closed each pane in its
own commit. Every commit re-ran the parking pass, whose functional setters
queued a render even when the sets were unchanged, so each commit left work
pending and React's nested-update counter climbed past 50 (#185), taking down
the terminal workbench boundary. Dispatch only when a set actually changes.

* fix: initialize parking state mirror lazily and verify transitions

---------

Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
Co-authored-by: m4air <m4air@Mac.localdomain>
AmethystLiang added a commit that referenced this pull request Oct 4, 2026
In Manual mode the sort hook copied every sortEpoch bump into state from an
effect, adding a nested React update per bump. A burst of store bumps at
startup stacked those into 'Maximum update depth exceeded' (React #185).
Manual now reads the live epoch directly; debounced modes are unchanged.
AmethystLiang added a commit that referenced this pull request Oct 4, 2026
…o state

The sort hook no longer copies sortEpoch into React state from an effect in
any mode; it reads the store's settledSortEpoch directly. That pattern added
a nested update per bump and stacked into "Maximum update depth exceeded"
(React #185) under flushSync bursts. Tests cover Manual, add/remove, burst
reset, no-bump row changes, mode switch, and 80 flushSync bumps in Recent
while worktrees are added.
AmethystLiang added a commit that referenced this pull request Oct 4, 2026
…#25313)

* fix(sidebar): stop Manual sort from mirroring sortEpoch into state

In Manual mode the sort hook copied every sortEpoch bump into state from an
effect, adding a nested React update per bump. A burst of store bumps at
startup stacked those into 'Maximum update depth exceeded' (React #185).
Manual now reads the live epoch directly; debounced modes are unchanged.

* feat(sidebar): tell people when a drop switches sort to Manual

Reordering by drag still switches the sidebar to Manual so the drop sticks,
but it used to happen silently. Show a toast with a 'Back to <previous sort>'
action; it retires itself on any later sort change so it can't override a
newer choice. Drops while already in Manual stay silent.

* feat(store): settle sortEpoch in the store instead of in React state

Add settledSortEpoch plus a 3 s settle timer owned by a store listener
installed in the state creator. Every write path (slice actions, the web
session sync patch) goes through it, so the settled value stays correct
with no sidebar mounted. Manual, a sort-mode switch, and a bump that
changes the non-archived row count settle in the same notify; other bumps
restart the window. A reset that lands settled clears the timer, and the
disposer runs on HMR teardown.

* fix(sidebar): read the settled sort epoch instead of mirroring it into state

The sort hook no longer copies sortEpoch into React state from an effect in
any mode; it reads the store's settledSortEpoch directly. That pattern added
a nested update per bump and stacked into "Maximum update depth exceeded"
(React #185) under flushSync bursts. Tests cover Manual, add/remove, burst
reset, no-bump row changes, mode switch, and 80 flushSync bumps in Recent
while worktrees are added.

* cleaning up

* fix(store): settle bumps when rows update during pending window

Detect structural changes on worktreesByRepo updates in addition to sort
epoch changes. When a row arrives without its own bump during a pending
settlement window, the changed composition must still trigger settlement.
AmethystLiang added a commit that referenced this pull request Oct 9, 2026
The "+N" overflow chip in the status bar changed width whenever its count changed, so the density probe that decides how many usage chips fit kept re-measuring. Reserve the width of the provider-count label with an invisible sizer span, so the chip keeps the same size across counts.

- Pass the total provider count into UsageOverflowChip and render it in an invisible, grid-stacked sizer span.
- Overlay the visible "+N" label on the same grid cell so the chip width tracks the total, not the hidden subset.
- Add an e2e test that loads ten usage providers, shrinks the viewport to collapse them, and checks the chip width stays stable and no "Maximum update depth" or React #185 errors occur.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant