Loader data not inherited by new dynamic child routes in SvelteKit 2.x #14042
Unanswered
jst20terrell
asked this question in
Q&A
Replies: 1 comment
-
Should this have been an issue? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
New child routes (folders) created under a dynamic parent ([levelId]) do not inherit loader data from the parent's +layout.js. Existing child routes (created before the issue appeared) continue to work and show the heading as expected.
Duplicating a working child route (scan → scan2) also results in the loader data not being inherited—parent loader is not run for new child routes.
There are no shadowing loaders or layouts in the child routes. Loader logic and structure are correct.
Console logs confirm that the loader is never run for new child routes, but still runs for existing siblings. There are no errors or warnings in the console or build output.
Full clean and rebuild (delete .svelte-kit, .vite, node_modules, lock files, cache, server reboot, move parent folder out and back in, even entire project clone) does NOT resolve the issue. This happens with the latest SvelteKit 2.22.0+ and Vite 7.x, and is not related to legacy migration.
Using SvelteKit: 2.22.0 (also tested 2.25.1, same result)
Node: v20.13.1
Browser: Edge
Computer Windows 11 Pro 64.
Server: Digital Ocean Linux
Reproduction: 1. Project structure:
Steps:
a. Add new child folder (e.g., testchild1) under /levels/[levelId]/
b. Add minimal +page.svelte
c. Start dev or prod server, visit /levels/1/testchild1
Result: Pill bar and child content render, but heading from parent loader is missing (data.heading is undefined). Existing children still work.
Logs: No errors or warnings in terminal or browser. Console.log inside [levelId]/+layout.js confirms loader is never called for new routes.
Beta Was this translation helpful? Give feedback.
All reactions