-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: prevent JSON parse error when loading data #11025
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
Conversation
🦋 Changeset detectedLatest commit: a1dace1 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 |
Why is the response to the non-existent file returned as HTML and not as json? Would it be possible to solve this at the prerendering stage instead by creating a |
My guess is it's because the route doesn't exist in the server manifest (due to it being prerendered). So a request to
Right now we always fetch the kit/packages/kit/src/runtime/client/client.js Lines 1847 to 1858 in 87a18b7
Yes, this is another good alternative solution. Another alternative, is to always return JSON when |
updated to fallback to native navigation when receiving a HTML response instead of JSON when loading |
} | ||
} | ||
} | ||
} | ||
handle_stream(); |
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.
What's this change about btw?
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.
ah I was trying to resolve to the TODO about the eslint error https://eslint.org/docs/latest/rules/no-async-promise-executor I can revert it though
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.
I don't think that lint rule applies here, so we can revert it
…ries to warn again
fixes #8751
This PR handles the edge case where loading the data of a non-existent prerendered dynamic route returns a 404 HTML page instead of JSON data. No test because our /basics test app has a root server layout load function, which causes it to do a native navigation instead, returning a 404 SSR response. The error only occurs when there is no root server layout load.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.