-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] avoid infinite loop if no routes found #2614
[fix] avoid infinite loop if no routes found #2614
Conversation
🦋 Changeset detectedLatest commit: bf7a7ba The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 isn't the right solution. The root path might be served by an endpoint, or it might not exist at all (especially if the SvelteKit app is behind something that only sends certain URLs to it), or the user may simply be using a different file extension for their page routes. |
032db9a
to
044cce1
Compare
Thank you for telling point what I'm not aware of. The direct cause is an infinity loop here. kit/packages/kit/src/core/create_app/index.js Lines 132 to 142 in 26e81e8
So I updated it to prevent infinity loop. And if none of the route components are present, this infinity loop comes. So right now I added warn message if there is no route component. |
da40196
to
6e38aad
Compare
index.svelte
not found@@ -118,7 +118,7 @@ function generate_app(manifest_data) { | |||
...manifest_data.routes.map((route) => | |||
route.type === 'page' ? route.a.filter(Boolean).length : 0 | |||
), | |||
0 | |||
1 | |||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a little comment explaining what max_depth of 1 then there are actually 0 routes means? It's not immediately obvious that this is produces an error somewhere else as a consequence.
fix: #2602
Please refer My Comment for details.
I handled onlysrc/routes/index.svelte
because if another file is not found, we can notice it on browser.(We can see a 404 message on browser.)(Is it correct that alwayssrc/routes/index.svelte
exists?🤔)-> According to the comment, may not have
src/routes/index.svelte
.Before submitting the PR, please make sure you do the following
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpx changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0