fix: prerender errors during development#16507
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/8ef31c60382b3ccd9eca70f5a0599938b642cf0cOpen in |
🦋 Changeset detectedLatest commit: 8ef31c6 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 |
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
|
/** @param {import('types').SSRState} state */
export function renders_prerendered_output(state) {
return !!state.prerendering || (DEV && state.prerender_default === true);
}The |
| } else if (page_nodes) { | ||
| config = page_nodes.get_config() ?? config; | ||
| prerender = page_nodes.prerender(); | ||
| prerender = state.prerender_default = page_nodes.prerender(); |
There was a problem hiding this comment.
is there any value in doing something like this immediately after this block, rather than adding prerender_default?
if (DEV && prerender) {
state.prerendering = {
dependencies: new Map(),
remote_responses: new Map()
};
}It's a bit of a kludge but it would mean we didn't need to worry about forgetting the
|| state.prerender_default === truepart of
if (state.prerendering || state.prerender_default === true) {...}Or does that not work for whatever reason?
There was a problem hiding this comment.
I checked. event_state is created earlier in respond with prerendering: state.prerendering, so the request store would keep undefined unless that becomes a getter (or gets the same assignment). #16508 makes it a bit less cumbersome.
We've been tracking the current page's prerender option during SSR so we might as well enable some page prerendering behaviours during development to match what they'll get during the build.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits