Repository navigation
fix(prompts): shallow-update tab/sort URL params instead of router.replace - #474
Merged
Merged
Conversation
…r.replace
The tab-sync effect called router.replace('?tab=all') on mount. That
fires an RSC round-trip whose prefetch render 500s server-side, the
navigation never completes, and Next then holds every queued server
action behind the pending transition — so the page's data fetch never
even dispatched. Symptom: the All Prompts table spun forever on cold
loads, in dev and in production alike (verified live: the router's
?tab=all request returns 503/500 while a plain RSC GET of the same URL
returns 200).
The tab and sort keys are pure client state; the URL is only updated so
deep links and reloads land on the same view. window.history.replaceState
does exactly that with no server request — Next's app router syncs with
the History API — so the action queue can never be blocked by it again.
Both call sites (tab sync + column sort) converted; useRouter is no
longer needed on this page.
7 of 12 tasks
gkhngyk
added a commit
that referenced
this pull request
Jul 18, 2026
Soft navigations to /dashboard/prompts (e.g. sidebar Visibility -> Prompts) still froze after #474: the navigation's RSC request carries the router state tree through the intl middleware and intermittently dies server-side with 'The router state header was sent but could not be parsed' (captured in Vercel function logs; known framework issue for broad proxy matchers on Vercel, vercel/next.js#91723). The failed transition then blocks the client's queued server actions, so the page's data fetch never dispatches. With a single 'en' locale the only thing next-intl's middleware does for these requests is the /en rewrite — do that manually for any request carrying an RSC or Next-Action header and skip the intl machinery entirely. Auth checks still run first; supabase session cookies are still forwarded. Document requests (no RSC header) keep going through next-intl unchanged.
7 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The All Prompts table spun forever on cold loads — in dev and in production. Root cause chain, verified live against production:
router.replace('?tab=all'), firing an RSC round trip.Error: The router state header was sent but could not be parsed(captured in Vercel function logs) — a known Next.js framework issue for apps with a broad proxy/middleware matcher on Vercel (App Router _rsc navigations intermittently fail with "The router state header was sent but could not be parsed" when Proxy matcher is broad on Vercel vercel/next.js#91723, related: 92907/92961). Our proxy matcher is necessarily broad (auth gate).getPromptsPageDatanever even dispatched. The suggestions card's call slipped through ahead of the replace; the table's never did.Fix: the tab and sort keys are pure client state — the URL is only updated so deep links and reloads restore the view.
window.history.replaceStatedoes exactly that with no server request (Next's app router syncs with the History API), so the crashing RSC round trip is gone and the action queue can never be blocked by it again. Both call sites converted (tab sync + column sort);useRouterdropped from the page.Verified in the browser: after the change the page load issues no
?tab=all&_rscrequest at all, and the URL still updates to?tab=all.Related issue
Direct fix for the urgent "prompts page never loads" report; the upstream framework issue remains open — if sporadic RSC navigation failures ever show up elsewhere, narrowing what the proxy does for RSC requests is the next lever.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
/dashboard/promptsin a fresh tab: the table loads; the Network tab shows no?tab=all&_rscrequest and no 503s; the URL bar still gains?tab=all.?sort=…&dir=…appears in the URL without any server request; reload preserves the sort.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)