Skip to content

fix: repro 1293 & 1156 in TSR#1318

Open
franky47 wants to merge 4 commits intonextfrom
fix/1293-tsr
Open

fix: repro 1293 & 1156 in TSR#1318
franky47 wants to merge 4 commits intonextfrom
fix/1293-tsr

Conversation

@franky47
Copy link
Member

@franky47 franky47 commented Jan 30, 2026

After the React Router fix in #1316 (and the added test for Next.js in #1317), it's TanStack Router's turn at #1293.

It did have an issue where the source page would re-render with destination URL state when navigating via a Link or the Back button.

Opus didn't manage to get to the end of its thoughts, but GPT-5.2-codex high found a way to switch between optimistic & resolved search based on whether or not we're in a navigation to another path (to avoid breaking the #1099 repro).

@franky47 franky47 added the adapters/tanstack-router Uses the TanStack Router adapter label Jan 30, 2026
@franky47 franky47 added this to the 🪵 Backlog milestone Jan 30, 2026
@franky47 franky47 added the adapters/tanstack-router Uses the TanStack Router adapter label Jan 30, 2026
@vercel
Copy link

vercel bot commented Jan 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nuqs Ready Ready Preview, Comment Feb 2, 2026 1:00pm

Request Review

Base automatically changed from fix/1293-next-tsr to next January 30, 2026 13:40
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 30, 2026

pnpm add https://pkg.pr.new/nuqs@1318

commit: cfe7924

@franky47 franky47 changed the title test: add failing test for 1293 in TSR fix: repro 1293 in TSR Jan 30, 2026
@franky47 franky47 marked this pull request as ready for review January 30, 2026 23:11
@franky47 franky47 requested a review from Copilot January 30, 2026 23:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the TanStack Router adapter to avoid leaking destination search params into still-mounted source pages (repro #1293) and adds E2E coverage for TanStack Router, including a delayed-loader variant to ensure behavior is robust under slower navigations.

Changes:

  • Update useNuqsTanstackRouterAdapter to distinguish between stable and in-flight navigations using useRouterState, caching the last stable search per adapter instance and using it during cross-page transitions.
  • Add TanStack Router E2E routes for the 1293 repro (/repro-1293/a|b and delayed /repro-1293-late/a|b) using the shared Repro1293 pages.
  • Add Playwright specs wiring TanStack Router into the shared repro-1293 test harness, including a delayed-loader variant with router tagging and description.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/nuqs/src/adapters/tanstack-router.ts Extends the adapter to read resolvedLocation via useRouterState, cache the last stable search per adapter instance, and derive URLSearchParams from a new activeSearch that switches between live and cached search depending on whether the current path is in a stable (resolved) state.
packages/e2e/tanstack-router/src/routes/repro-1293.a.tsx Declares TanStack Router route /repro-1293/a rendering Repro1293PageA with a link to /repro-1293/b, matching the shared repro-1293 behavior.
packages/e2e/tanstack-router/src/routes/repro-1293.b.tsx Declares TanStack Router route /repro-1293/b rendering Repro1293PageB, which handles the back navigation portion of the repro.
packages/e2e/tanstack-router/src/routes/repro-1293-late.a.tsx Adds a second route /repro-1293-late/a that reuses Repro1293PageA but targets the delayed-loader variant at /repro-1293-late/b.
packages/e2e/tanstack-router/src/routes/repro-1293-late.b.tsx Adds /repro-1293-late/b with a simple async loader that waits before rendering Repro1293PageB, exercising the adapter under delayed navigation.
packages/e2e/tanstack-router/specs/shared/repro-1293.spec.ts Wires TanStack Router into the shared testRepro1293 harness with path: '/repro-1293', mirroring the RR and Remix shared specs.
packages/e2e/tanstack-router/specs/repro-1293-late.spec.ts Adds a dedicated Playwright spec for the delayed-loader variant, invoking testRepro1293 with path: '/repro-1293-late' plus router: 'tanstack-router' and a descriptive label.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@franky47 franky47 changed the title fix: repro 1293 in TSR fix: repro 1293 & 1156 in TSR Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adapters/tanstack-router Uses the TanStack Router adapter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant