Describe the bug
When you access event.routeId in a layout load function, the load function does not re-run when routeId changes. Since routeId is based on the URL, we should track dependencies to it similar to url and params.
This probably only makes sense in a layout load. On page loads, routeId should stay the same.
Reproduction
StackBlitz
- Load page. Notice routeId for the current page is displayed
- Navigate to another page. The routeId does not change until a page reload
In this case you could work around the issue by retrieving it from the $page store, but if you're doing something else with routeId, that would not be re-run.
// +layout.server.js
export const load = ({routeId}) => {
return {
routeId
}
}
Logs
System Info
System:
OS: Linux 5.0 undefined
CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.17.0 - /usr/local/bin/npm
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.80
@sveltejs/kit: next => 1.0.0-next.499
svelte: ^3.46.0 => 3.50.1
vite: ^3.1.0 => 3.1.3
Severity
serious, but I can work around it
Additional Information
No response
Describe the bug
When you access
event.routeIdin a layoutloadfunction, theloadfunction does not re-run whenrouteIdchanges. Since routeId is based on the URL, we should track dependencies to it similar to url and params.This probably only makes sense in a
layoutload. Onpageloads, routeId should stay the same.Reproduction
StackBlitz
In this case you could work around the issue by retrieving it from the
$pagestore, but if you're doing something else withrouteId, that would not be re-run.Logs
System Info
System: OS: Linux 5.0 undefined CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 16.14.2 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.17.0 - /usr/local/bin/npm npmPackages: @sveltejs/adapter-auto: next => 1.0.0-next.80 @sveltejs/kit: next => 1.0.0-next.499 svelte: ^3.46.0 => 3.50.1 vite: ^3.1.0 => 3.1.3Severity
serious, but I can work around it
Additional Information
No response