Skip to content

Commit

Permalink
fix: use render tag when generating a default fallback page (#12653)
Browse files Browse the repository at this point in the history
fixes #12652

Adds a fallback component using the Svelte 5 render tag and uses that if it detects the app is using Svelte 5.
  • Loading branch information
eltigerchino authored Sep 5, 2024
1 parent 109722c commit 60e2296
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/pretty-planets-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: use `{@render ...}` tag when generating default fallback page for svelte 5 apps
1 change: 1 addition & 0 deletions packages/kit/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
test/build-errors/apps/syntax-error/src/routes/+page.svelte
/types
src/runtime/components/svelte-5/layout.svelte
3 changes: 2 additions & 1 deletion packages/kit/src/core/sync/create_manifest_data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { list_files, runtime_directory } from '../../utils.js';
import { posixify, resolve_entry } from '../../../utils/filesystem.js';
import { parse_route_id } from '../../../utils/routing.js';
import { sort_routes } from './sort.js';
import { isSvelte5Plus } from '../utils.js';

/**
* Generates the manifest data used for the client-side manifest and types generation.
Expand All @@ -18,7 +19,7 @@ import { sort_routes } from './sort.js';
*/
export default function create_manifest_data({
config,
fallback = `${runtime_directory}/components`,
fallback = `${runtime_directory}/components/${isSvelte5Plus() ? 'svelte-5' : 'svelte-4'}`,
cwd = process.cwd()
}) {
const assets = create_assets(config);
Expand Down
6 changes: 6 additions & 0 deletions packages/kit/src/runtime/components/svelte-5/error.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script>
import { page } from '$app/stores';
</script>

<h1>{$page.status}</h1>
<p>{$page.error?.message}</p>
5 changes: 5 additions & 0 deletions packages/kit/src/runtime/components/svelte-5/layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
let { children } = $props();
</script>

{@render children()}

0 comments on commit 60e2296

Please sign in to comment.