-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat: allow to control behavior on hydration error #13521
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: b7884d3 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 is awesome, thanks for the quick fix @dummdidumm 🙏 |
return; | ||
} else { |
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.
nitpick: since we return here, we don't need the else here
Hi, do we have an ETA for this fix to land, I know I am kind of rushing this but this has been a constant pain point for a lot of users and we are getting a lot of pressure now to get this fixed. The only other way to fix this currently is to patch kit on our end. Thanks 🙏 |
route | ||
}); | ||
if (__SVELTEKIT_NO_ROOT_ERROR_ON_HYDRATION__) { | ||
errored_on_hydration = true; |
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.
How will the client know that this has happened and the page is not hydrated?
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.
Yes, good point. We probably also want the await handle_error(error, { url, params, route })
call as before so that normal error reporting if any does work for this error
closes #13519
This adds a new option to the SvelteKit router that allows you to control how to react when a page doesn't successfully hydrate. You can choose to keep it as is today (show root error page; the default) or keep the HTML around (the new option).
Name is subject to bikeshedding and I'm pretty sure there are better names. Also haven't talked to other maintainers yet if this is a generally good direction (but I think it's a pragmatic solution to the real world of flaky internet connections).
For now it only handles the part when loading the JS/data prior to the "hydrate the components", might be worthwhile to investigate that other part in the future as well.
Also needs tests.
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:
.