Skip to content

Always show fresh pages after in-app navigation (dashboard new-form fix) - #16

Merged
shatheitguy merged 1 commit into
mainfrom
dashboard-always-fresh
Nov 19, 2026
Merged

shatheitguy merged 1 commit into
mainfrom
dashboard-always-fresh

Conversation

@shatheitguy

Copy link
Copy Markdown
Owner

What changed

components/nav-progress.tsx records each page data request Next.js starts (RSC: 1, excluding prefetches). After every in-app page change it checks whether the server was asked for that page; if not (the page came from Next.js's in-memory copy), it calls router.refresh(). Replaces the popstate-only refresh from #14.

Why

Reproduced on a live 1.1.3 install (behind Cloudflare, not cached there): signed in → New form → builder → Dashboard. The click made no request for /, and the new form was missing until a reload. staleTimes.dynamic = 0 (#13) didn't cover it because the dashboard copy came from opening it inside the app (after sign-in), which Next.js 14 reuses anyway. Calling router.refresh() there brought the form in.

Testing

  • tsc --noEmit passes; local production build (next build && next start).
  • Dashboard click from the builder: new form shown, exactly 1 request for / (no double fetch).
  • Back from the builder: new form shown, exactly 1 request for /.
  • Live install: manual router.refresh() after the stale Dashboard click showed the missing form. The test form was then deleted for good (Trash → Delete forever).

Next.js sometimes shows a page from its in-memory copy without asking the
server: on Back/Forward, and, despite staleTimes.dynamic = 0, for pages first
opened inside the app (e.g. the dashboard after signing in). Reproduced on a
live install: Dashboard click made no request and the new form was missing.

NavProgress now notes every page data request (RSC, not prefetch) as it
starts. After each in-app page change, if the server wasn't asked for that
page, it calls router.refresh(): the copy shows at once, then the fresh page.
Normal navigations still make exactly one request. Replaces the popstate-only
refresh.
@shatheitguy
shatheitguy merged commit 4de312b into main Nov 19, 2026
3 checks passed
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