Skip to content

fix(sveltekit): Read load event pathname untracked - #25235

Draft
chargome wants to merge 2 commits into
developfrom
sveltekit-load-pathname
Draft

chargome wants to merge 2 commits into
developfrom
sveltekit-load-pathname

Conversation

@chargome

@chargome chargome commented Oct 9, 2026

Copy link
Copy Markdown
Member

The url.path attribute added in #24341 made the load wrappers read event.url.pathname outside untrack. SvelteKit took that as the load depending on the URL, so every wrapped load reran on each navigation. With auto-instrumentation on, that's every load in the app.

The pathname is now read through event.untrack, the same way getRouteId already reads route.id. On SvelteKit 2 versions that don't have untrack yet, it calls the native URL.prototype getter instead. SvelteKit's tracking getter is an own property on event.url, so the native getter skips it.

Fixes #25231

The load wrappers read event.url.pathname for the url.path attribute
outside of untrack, so SvelteKit marked every wrapped load as depending
on the URL and reran it on each navigation. Read the pathname through
untrack, or the native URL getter when untrack is unavailable.

Fixes #25231
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chargome chargome self-assigned this Oct 9, 2026
@chargome

chargome commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/sveltekit/test/client/load.test.ts Outdated
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chargome

chargome commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit fa1eba6. Configure here.

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.

SvelteKit: load wrappers read event.url.pathname tracked, so every instrumented load reruns on navigation

1 participant