Skip to content

Commit

Permalink
revert #8131
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Mar 7, 2023
1 parent 6a91e88 commit 7243751
Show file tree
Hide file tree
Showing 21 changed files with 1 addition and 182 deletions.
27 changes: 1 addition & 26 deletions packages/kit/src/runtime/server/page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,38 +79,13 @@ export async function render_page(event, page, options, manifest, state, resolve
// it's crucial that we do this before returning the non-SSR response, otherwise
// SvelteKit will erroneously believe that the path has been prerendered,
// causing functions to be omitted from the manifesst generated later
const should_prerender = get_option(nodes, 'prerender');

const should_prerender = get_option(nodes, 'prerender') ?? false;
if (should_prerender) {
const mod = leaf_node.server;
if (mod?.actions) {
throw new Error('Cannot prerender pages with actions');
}
} else if (state.prerendering) {
// Try to render the shell when ssr is false and prerendering not explicitly disabled.
// People can opt out of this behavior by explicitly setting prerender to false.
if (
should_prerender !== false &&
get_option(nodes, 'ssr') === false &&
!leaf_node.server?.actions
) {
return await render_response({
branch: [],
fetched: [],
page_config: {
ssr: false,
csr: get_option(nodes, 'csr') ?? true
},
status,
error: null,
event,
options,
manifest,
state,
resolve_opts
});
}

// if the page isn't marked as prerenderable, then bail out at this point
return new Response(undefined, {
status: 204
Expand Down
1 change: 0 additions & 1 deletion packages/kit/test/prerendering/ssr-false/.gitignore

This file was deleted.

21 changes: 0 additions & 21 deletions packages/kit/test/prerendering/ssr-false/package.json

This file was deleted.

1 change: 0 additions & 1 deletion packages/kit/test/prerendering/ssr-false/src/app.d.ts

This file was deleted.

11 changes: 0 additions & 11 deletions packages/kit/test/prerendering/ssr-false/src/app.html

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions packages/kit/test/prerendering/ssr-false/svelte.config.js

This file was deleted.

39 changes: 0 additions & 39 deletions packages/kit/test/prerendering/ssr-false/test/test.js

This file was deleted.

16 changes: 0 additions & 16 deletions packages/kit/test/prerendering/ssr-false/tsconfig.json

This file was deleted.

27 changes: 0 additions & 27 deletions packages/kit/test/prerendering/ssr-false/vite.config.js

This file was deleted.

16 changes: 0 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7243751

Please sign in to comment.