Skip to content

fix(web): stop account nav session-check flicker#126

Merged
Zach Dunn (zachdunn) merged 1 commit into
mainfrom
fix/account-session-flicker
Jul 13, 2026
Merged

fix(web): stop account nav session-check flicker#126
Zach Dunn (zachdunn) merged 1 commit into
mainfrom
fix/account-session-flicker

Conversation

@zachdunn

Copy link
Copy Markdown
Member

In plain terms

Moving between account sections (/account/account/workspaces, etc.) was flashing “Checking your session…” and collapsing the layout on every click. That was the client session gate re-running from a blank slate on each full page load.

What it does

  • After a successful session check, cache a small user snapshot in sessionStorage
  • On the next navigation, paint the signed-in shell synchronously (inline script) so the chrome never drops
  • Revalidate with get-session in the background; if the session is gone, flip to signed-out and clear the cache
  • Clear the cache on sign-out
  • Same treatment for /admin/* (admin role required for optimistic paint)

What it is not

  • Not a security change — API/auth still enforce the real session
  • Not View Transitions / ClientRouter (those alone wouldn’t fix the gate; this targets the root cause)
  • First visit after login still shows “Checking…” once (no cache yet)

Why not View Transitions?

ClientRouter would soft-navigate, but each account page still shipped with #app hidden and re-ran the gate, so the flicker would remain unless we also persisted or cached session state. Caching is the smaller, more direct fix; VT can still be layered later for content crossfades if we want polish.

How to try it

  1. Sign in and open /account (expect one “Checking…” on first load).
  2. Click Workspaces, Account, Developers — the sidebar/header should stay put with no checking flash.
  3. Hard-refresh a nested path — still no flash after the first successful check in the tab.
  4. Sign out and open /account again — should show signed-out (cache cleared).

Test plan

  • pnpm --filter @uploads/web test
  • pnpm --filter @uploads/web typecheck
  • Manual: click through account sections on a deployed or local preview

Cache the session user in sessionStorage and paint the signed-in shell
optimistically on subsequent /account and /admin navigations, then
revalidate in the background so the chrome no longer flashes Checking…
between sections.
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (2)
  • coderabbit:review
  • review
🚫 Excluded labels (none allowed) (1)
  • wip

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ed790493-1295-4898-b0e9-5484c6dc6037

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/account-session-flicker

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
uploads-web fb1db43 Commit Preview URL

Branch Preview URL
Jul 13 2026, 03:26 PM

@zachdunn Zach Dunn (zachdunn) merged commit c2491b1 into main Jul 13, 2026
4 checks passed
@zachdunn Zach Dunn (zachdunn) deleted the fix/account-session-flicker branch July 13, 2026 15:26
Zach Dunn (zachdunn) added a commit that referenced this pull request Jul 13, 2026
Port the branch's work onto the #125/#126 restructure:
- AccountLayout/AdminLayout adopt BaseHead (DS tokens/fonts/favicon);
  SITE_FAVICON removed from signed-in-page.ts
- signed-in-shell.css drops its :root copy and the side-stripe .status;
  session-gate blocks render as ul-callout (data-state=error for denied)
  and each shell gets an sr-only h1
- workspaces.astro: file browsers mount via IntersectionObserver;
  invite copy buttons announce via aria-live
- account-shell.ts taken from main wholesale (hash-panel focus fix is
  obsolete under path-based navigation)
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