Skip to content

fix: set enter navigation source to null when SSR is disabled - #17588

Draft
svelte-triage-bot[bot] wants to merge 1 commit into
mainfrom
triage/kit-17586-enter-from
Draft

svelte-triage-bot[bot] wants to merge 1 commit into
mainfrom
triage/kit-17586-enter-from

Conversation

@svelte-triage-bot

Copy link
Copy Markdown
Contributor

Fixes #17586

On a direct load with ssr = false, navigate constructs the initial enter navigation before current represents a page. The shared constructor nevertheless creates a source target from that empty state, exposing from.url === null despite NavigationTarget.url being a URL. Consequently, expressions such as navigation.from?.url.pathname throw. Hydration already supplies from: null.

#13593 intentionally moved client-only startup onto the navigation path so that it emits one enter callback rather than separate enter and goto callbacks. That mechanism remains necessary; its constructor simply retained the old assumption that every navigation has an outgoing page. #17577 corrected the destination of the separate hydrating startup path, but did not affect this source target.

Construct from: null for enter navigations in the shared constructor, rather than fabricating an initial target or overwriting it later. This preserves startup callback timing and redirect handling, and leaves non-enter targets unchanged, including scroll information from #15248 and shallow-navigation handling from #16449.

The existing client-only fixture now covers direct entry, reload, the initial destination, and a subsequent goto with a real source target. The hydrated dynamic-route fixture also checks its null source, protecting the parallel startup path.

@pkg-svelte-dev

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 3a5a111:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/3a5a11186f685fd4557ab3cfc465cf606ddb60ab

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/17588

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Oct 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3a5a111

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit 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

This branch has not been deployed

No deployments
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.

[BUG] afterNavigate gets a from with url: null on start when SSR is disabled

0 participants