Skip to content

fix: let a navigation back to the shown route cancel a pending one - #719

Open
thelastbackspace wants to merge 1 commit into
solidjs:mainfrom
thelastbackspace:fix/714-pending-link-navigation
Open

thelastbackspace wants to merge 1 commit into
solidjs:mainfrom
thelastbackspace:fix/714-pending-link-navigation

Conversation

@thelastbackspace

Copy link
Copy Markdown

While a navigation to a slow route was pending, navigating back to the route still on screen was ignored, and the slow route showed up once its data resolved.

navigateFromRoute compared the new target against reference(), which still points at the shown route while the transition is pending, so /a looked like a no-op and never reached transition(). It now compares against the pending target when there is one. Since that navigation ends where it started, navigateEnd also skips setSource when the final location and state equal the first referrer, otherwise a second /a history entry gets pushed. referrers is still cleared either way.

Navigating to the same route with fresh state still pushes an entry like before, since the state actually changes.

Added test/pending-navigation.spec.tsx: starting on /a, navigate to a route behind an unresolved resource, navigate back to /a, resolve the resource, and check that /a is still shown and Back goes to / (no duplicate entry). It fails on main with expected '/slow' to be '/a' and passes with the change. vitest run, the SSR config and tsc -p tsconfig.test.json pass locally. Added a patch changeset.

Fixes #714

@changeset-bot

changeset-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4ef6e82

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

Link back to the shown route is ignored during a pending Suspense navigation in 1.0.1

1 participant