Repository navigation
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Self-hosted/on-premise
Which SDK are you using?
@sentry/sveltekit
SDK Version
11.6.0
Framework Version
@sveltejs/kit 3.0.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
// vite.config.ts
import { sentrySvelteKit } from '@sentry/sveltekit/vite';
sentrySvelteKit({ autoInstrument: { load: true, serverLoad: true } });Steps to Reproduce
- Add a
+layout.server.tsload that doesn't readurl, so SvelteKit only reruns it when one of its own dependencies changes. - Enable load auto-instrumentation (or wrap the load with
wrapServerLoadWithSentry). - Navigate between two pages under that layout.
Minimal check without an app, which is what we run in our tests:
import { wrapServerLoadWithSentry } from '@sentry/sveltekit';
const reads: string[] = [];
let tracking = true;
const url = new Proxy(new URL('https://example.com/a'), {
get(target, prop) {
if (tracking && typeof prop === 'string') reads.push(prop);
const value = Reflect.get(target, prop);
return typeof value === 'function' ? value.bind(target) : value;
},
});
const untrack = <T>(fn: () => T) => {
tracking = false;
try {
return fn();
} finally {
tracking = true;
}
};
await wrapServerLoadWithSentry(() => ({}))({
url,
untrack,
route: { id: '/a' },
request: { method: 'GET' },
} as never);
console.log(reads); // [ 'pathname' ]Expected Result
The wrapper doesn't add a URL dependency to the load. Like 10.x, where event.url.pathname was only read as a fallback span name when there's no route id.
Actual Result
The layout load reruns on every navigation. The url.path attribute added in #24341 reads event.url.pathname outside untrack in wrapLoadWithSentry (client and server) and wrapServerLoadWithSentry, so SvelteKit marks every wrapped load as depending on the pathname. With auto-instrumentation on, that's every load in the app, including root layouts that fetch session data.
Additional Context
getRouteId already reads event.route.id through event.untrack for exactly this reason. Reading the pathname the same way fixes it. We're carrying this as a patch on 11.6.0:
const pathname = typeof event.untrack === 'function'
? event.untrack(() => event.url.pathname)
: event.url.pathname;
const routeOrPathname = routeId ? routeId : pathname;
// ...
[URL_PATH]: pathname,Priority
React with π to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsNo status
Activity
linear-code commentedon Oct 9, 2026
JS-3903
chargome commentedon Oct 9, 2026
@ndri thanks for the report, we'll check it out!
test(sveltekit): Add e2e test for layout loads not rerunning on navigβ¦
fix(sveltekit): Read load event pathname untracked (getsentry#25235)
github-actions commentedon Oct 12, 2026
A PR closing this issue has just been released π
This issue was referenced by PR #25235, which was included in the 11.7.0 release.