Skip to content

perf(web): smooth Home item navigation without full-page snapshots - #74

Merged
blurbery merged 2 commits into
mainfrom
fix/smooth-navigation-motion
Aug 30, 2026
Merged

blurbery merged 2 commits into
mainfrom
fix/smooth-navigation-motion

Conversation

@blurbery

@blurbery blurbery commented Aug 30, 2026 •

Copy link
Copy Markdown
Owner

What this fixes

Opening an item from Home and returning to Home could become visibly jagged, especially after visiting several different items. The desktop route was snapshotting two pages with very different heights while the live sidebar was also moving. Cached detail trees, Home card rows and every hidden hero animation could then compete for the same frames.

This keeps that exact Home/item boundary lightweight while leaving every other route unchanged.

What changed

  • Skip full-page View Transition snapshots only for desktop / ↔ /item/* navigation. Mobile and every non-Home route keep their existing behavior.
  • Let the live compositor-driven sidebar carry the transition and gate cached Home item details until that movement has settled.
  • Prepare cached detail trees concurrently, keeping the handoff shell committed until React can swap the finished detail tree in without blocking the last sidebar frame.
  • Use eight fixed opaque skeleton blocks for the Home handoff. They do not pulse, load artwork, blur, measure content or remain mounted after the real detail paints.
  • Keep that opaque shell mounted when item data is still loading after the motion gate instead of falling through to the generic pulsing skeleton.
  • Reserve fixed responsive logo space and give only the bounded poster/copy group a 250 ms opacity settle. There is no transform, filter, backdrop blur or full-page transition layer.
  • Match Home item entry and Home return at 340 ms while every other route keeps the existing 300 ms sidebar timing.
  • Seed Home synchronously from the query cache, avoid no-op Map/Set replacements, mount two ready rows first and restore every deferred row through bounded observer/timer cleanup.
  • Keep only the active Home hero slide's Ken Burns animation and will-change; hidden slides no longer animate or re-render their parent when images finish loading.
  • Respect reduced motion and retain a hard detail-reveal deadline so a cancelled, hidden-tab or failed transition cannot leave the item page stuck.

Scope and safeguards

  • Desktop Home → item → Home only
  • Modified clicks, new tabs, direct item loads, mobile, item-to-item and library-to-item navigation are preserved
  • Deferred Home rows are temporary, not permanent virtualization; all rows are restored for browser Find and assistive technology
  • Observers, timeouts and transition polling are disconnected or cleared on reveal/unmount
  • No new cache, worker, background task, image preload or unbounded collection
  • No blur was added

Benchmarks

Measured against the same authenticated library in Chrome at 1200 × 681, DPR 2. The production baseline used five repeated cycles. The patch was exercised through the local Vite server, so absolute route timings are included as diagnostic evidence rather than presented as a production-bundle apples-to-apples claim. DOM, animation-count and lifecycle measurements are exact.

Metric Before After Change
Home DOM at the first sampled return paint ~7,580 nodes 2,181 nodes 5,399 fewer, ~71.2% reduction
Home rows mounted at that first sample 10 3 mounted + 7 fixed placeholders Heavy card work moved out of the handoff
Settled Home rows 10 10 No permanent virtualization
Simultaneous Home hero Ken Burns animations 10 1 90% reduction
Longest Back long task in the five-cycle runs 299 ms 182 ms 117 ms shorter, ~39.1% reduction
Navigation CLS observed in the broader trace/stress runs 0.05 0–0.001 Near-zero in patched stress runs

Raw production baseline, five cycles:

Measurement Open Back
Route commit median 7.5 ms 9.1 ms
Detail-ready median 33.8 ms n/a
Median p95 frame gap 33.3 ms 17.7 ms
Worst frame gap 215.7 ms 300 ms
Frame gaps over 20 / 33 / 50 ms 12 / 12 / 6 8 / 8 / 7
Long tasks 1 task, 55 ms total 5 tasks, 1,398 ms total; 299 ms longest
Layout shift 0.0402 0

The baseline production trace also recorded INP 173 ms, Home→item LCP 1,156 ms, Back LCP 802 ms, CLS 0.05 and 40 ms forced reflow.

Patched checks:

  • Five distinct cached items: detail reveal median ~439 ms after the intentional sidebar carry; Back completion samples 137–199 ms; longest long-task samples 123–182 ms; CLS ≤ 0.0004.
  • Twelve distinct open/Back cycles: no stuck gate, stable settled DOM and no monotonic heap retention. After idle GC, the final heap sample returned below the starting sample in the observed run.
  • Final ten-cycle repeat test across five different series, then the same five cached: 10/10 showed exactly eight opaque blocks with zero pulse during the handoff; 10/10 removed every block and painted the detail by the settled sample; the final Home contained zero leftover transition nodes.
  • Final same-item repeat check after matching entry/return timing: 5/5 cached opens completed with the 340 ms boundary token, zero pulsing fallback, a settled detail tree and no stuck shell or transition overlay.
  • Home ultimately restored all 10 rows and approximately 7,547 settled nodes, confirming that the first-paint reduction does not discard content.

Validation

  • vitest: 110/110 focused navigation, Home, layout, hero and item-detail tests passed
  • TypeScript project check passed
  • Prettier check passed
  • ESLint: zero errors; one pre-existing Calendar set-state-in-effect warning remains unchanged
  • Chrome manual checks covered first and cached opens, repeated same-item opens, multiple different items, Back, modified links, and reduced-motion behavior

AI disclosure

I orchestrated, directed and manually reviewed this work. Codex assisted with implementation, test coverage, browser checks and benchmark collection.

@blurbery
blurbery merged commit ca55368 into main Aug 30, 2026
3 checks passed
@blurbery
blurbery deleted the fix/smooth-navigation-motion branch November 6, 2026 00:01
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