Skip to content

fix: hide the object panel while a route change renders - #81

Merged
Vonng merged 2 commits into
mainfrom
claude/detail-panel-history-race
Nov 4, 2026
Merged

Vonng merged 2 commits into
mainfrom
claude/detail-panel-history-race

Conversation

@Vonng

@Vonng Vonng commented Nov 4, 2026

Copy link
Copy Markdown
Member

Contribution Licensing (no CLA, inbound=outbound, DCO required)

This pull request contributes to PGSTY SILO Console (pgsty/silo-console).
Code contributions are accepted under
GNU AGPL v3.0 or later
(AGPL-3.0-or-later), the same license as SILO Console.
By submitting this pull request I represent that I have the right to contribute
the changes under that license and retain copyright in my original work.
No CLA, copyright assignment, or separate Apache-2.0 license grant is required.
Existing copyright and license notices remain intact; separately licensed
material keeps its applicable terms. Every commit must carry a DCO
Signed-off-by trailer (git commit -s); see
CONTRIBUTING.md.

Description and motivation

object-detail-stale.spec.ts › "history navigation never shows an actionable panel for another route" flaked on CI's Linux runners. It was reported as flaky on both runs of #80, and the same race exists on 5175e5c. After Back from alpha.txt to the bucket root, a sampled frame still showed a visible, non-inert details panel reading alpha.txt under the bucket-root URL. With a 6x CDP CPU throttle it reproduces on every run.

Root cause. React Router 7's RouterProvider applies every router state update inside React.startTransition. The router moves synchronously: history.pushState, or the browser's URL on popstate, then router.state.location, then its subscribers. React then renders the new location as an interruptible, time-sliced transition. Until that commits, the committed tree, including useLocation() in ListObjects, still describes the previous route. On a slow CPU that takes several painted frames, so the details panel stays actionable for the object the URL just left. The existing detailsIdentityMatches gate cannot see this, because both of its inputs come from the same stale commit. The same gap affects an object switch (click B while A is open: URL B, panel still A) and the versions-mode navigator.

Diagnosis: with <RouterProvider useTransitions={false}> the throttled repro passes 10/10. I did not ship that, because it changes Suspense behaviour for every lazy route in the app.

Fix.

  • common/routeRenderPending.ts is a small external store fed by router.subscribe, wired in MainRouter.tsx next to createBrowserRouter. Its hook, useRouteRenderPending(), uses useSyncExternalStore, which always renders synchronously. It reports when the router's accepted location key differs from the committed useLocation().key. Blocked navigations, fetchers and revalidations keep the same key, so they never mark a route as pending.
  • RouteBoundContent keeps object-scoped content mounted, so its state survives, but sets inert, aria-busy and visibility: hidden in the same commit, before the browser can paint. It wraps the details panel content (desktop inline and mobile sheet) and the versions-mode VersionsNavigator. The panel frame keeps its width, so switching objects does not shift the layout.

Regression. A new chromium test, "on a slow CPU no route change leaves another object's panel actionable", throttles the CPU 6x. For an object switch (push), Back, Back and Forward, it samples which object names the panel shows as actionable at two points: at the end of the task that changed the URL (popstate microtask, or Navigation API currententrychange for push), and on the next 30 animation frames. It also checks that the panel is actionable again once the navigation has rendered. The existing history test is unchanged. The object-identity-guards source guard now also requires the route-pending wrapper.

Validation

All runs were local against a 4-drive SILO fixture built from pgsty/silo main (69fcf50c), with MINIO_CI_CD=1, the common.sh users and policies, the usage worker on a disposable Postgres, Console on :9090, Node 24.22.1 and Yarn 4.13.0.

  • Old test, throttled 6x, --repeat-each=40: failed on main (as reported); 40/40 passed with this change.
  • New regression without the fix: 20/20 failed throttled (for example, 8 consecutive frames show alpha.txt actionable under the beta.txt URL). It also failed 10/10 with no throttling, because the end-of-task sample does not depend on CPU speed.
  • New regression with the fix: 30/30 passed (--repeat-each=15 together with the old test).
  • Full --project=unit --project=chromium --workers=3: 850 passed.
  • yarn typecheck, ./check-prettier.sh (prettier --check .), ./check-deadcode.sh, ./check-warnings.sh, yarn check:bundle: pass.
  • make verifiers (fmt, golangci-lint 2.15.0: 0 issues, replacements, deps-release, credits) and go test ./...: pass.
  • web-app/build was rebuilt with make build-static, and a second build is byte-identical.

Compatibility and documentation impact

Frontend only, with no API, permission or SILO integration changes. While a route change is rendering, which is usually under a frame, the details panel content and versions navigator are blank and inert instead of showing the previous object. No documentation update is needed.

Checklist

  • All commits are signed off (git commit -s) per the DCO
  • Relevant tests and checks pass
  • Compatibility and UI impact documented
  • Public documentation update opened in pgsty/silo.pgsty.com, if needed (not needed)

🤖 Generated with Claude Code

Vonng and others added 2 commits November 5, 2026 01:18
React Router 7 applies each accepted navigation inside React.startTransition.
The router updates history and router.state synchronously, but the committed
tree, useLocation() included, keeps the previous route until the transition
commits. On a slow CPU that render spans several painted frames. During those
frames the details panel (and the versions navigator) stayed visible and
actionable for the object the URL had just left: after Back from alpha.txt to
the bucket root, or after clicking beta.txt while alpha.txt was open.

Publish the router's accepted location key from router.subscribe through a
useSyncExternalStore hook, which always renders synchronously. While the key
differs from the committed location, the object browser keeps its
object-scoped content mounted but makes it inert, aria-busy and hidden in the
same commit, before the browser can paint. Disabling transitions for the
whole router would also close the gap, but it would change Suspense behaviour
for every lazy route.

The new browser regression throttles the CPU 6x and samples the panel at the
end of each URL-changing task and on the following frames, for an object
switch, Back, Back and Forward. Without this change it fails on every run, and
its end-of-task sample fails even without throttling.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Feng Ruohang <[email protected]>
@Vonng Vonng mentioned this pull request Nov 4, 2026
5 tasks done
Vonng added a commit that referenced this pull request Nov 4, 2026
Merge the validated 2.6.0 draft-release candidate, including PR #81, Go security updates, embedded HTTP/2 keep-alive and release metadata. Formal publication remains pending maintainer approval.

Signed-off-by: Feng Ruohang <[email protected]>
@Vonng
Vonng merged commit 7bf3da8 into main Nov 4, 2026
41 of 42 checks passed
@Vonng
Vonng deleted the claude/detail-panel-history-race branch November 9, 2026 05:24
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