Skip to content

Commit 874815a

Browse files
committed
refactor(test-app): use $props in Svelte pages
Refactor Svelte test app pages to use $props() for prop extraction instead of export let syntax. This improves consistency and leverages Svelte 5 conventions for props handling.
1 parent bf61286 commit 874815a

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

packages/svelte5/test-app/Pages/ClientSideVisit/Page1.svelte

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
bar: string
88
}
99
10-
export let foo: string
11-
export let bar: string
10+
const { foo, bar }: { foo: string; bar: string } = $props()
1211
13-
let errors = 0
14-
let finished = 0
15-
let success = 0
12+
let errors = $state(0)
13+
let finished = $state(0)
14+
let success = $state(0)
1615
1716
const bagErrors = () => {
1817
router.replace({

packages/svelte5/test-app/Pages/FormComponent/DisableWhileProcessing.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import { Form } from '@inertiajs/svelte5'
3-
export let disable: boolean = false
3+
const { disable = false }: { disable?: boolean } = $props()
44
let url = `/form-component/disable-while-processing/${disable ? 'yes' : 'no'}/submit`
55
</script>
66

packages/svelte5/test-app/Pages/History/Page.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<script lang="ts">
22
import { inertia, router } from '@inertiajs/svelte5'
33
4-
export let pageNumber
5-
export let multiByte
4+
const { pageNumber, multiByte } = $props()
65
</script>
76

87
<a href="/history/1" use:inertia>Page 1</a>

packages/svelte5/test-app/Pages/Links/PartialReloads.svelte

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<script lang="ts">
22
import { inertia } from '@inertiajs/svelte5'
33
4-
export let foo = 0
5-
export let bar
6-
export let baz
7-
export let headers
4+
const { foo = 0, bar, baz, headers } = $props()
85
</script>
96

107
<div>

packages/svelte5/test-app/Pages/Visits/PreserveState.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { router } from '@inertiajs/svelte5'
33
import { onMount } from 'svelte'
44
5-
export let foo = 'default'
5+
const { foo = 'default' } = $props()
66
77
onMount(() => {
88
window._inertia_page_key = crypto.randomUUID()

0 commit comments

Comments
 (0)