From 64e8aa7d1d3e6733d09152cd6ab393545dc89605 Mon Sep 17 00:00:00 2001 From: Ryan Carniato Date: Wed, 2 Sep 2026 17:40:22 -0700 Subject: [PATCH] fix(examples): migrate remaining React-style createEffect calls to Solid 2.0 two-phase signature Co-authored-by: Cursor --- .../src/hooks/useSessionStorage.tsx | 7 ++++--- .../src/routes/dashboard.invoices.$invoiceId.tsx | 4 ++-- .../start-bun/src/routes/demo.start.api-request.tsx | 9 ++++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/solid/kitchen-sink-solid-query-file-based/src/hooks/useSessionStorage.tsx b/examples/solid/kitchen-sink-solid-query-file-based/src/hooks/useSessionStorage.tsx index ff2ca73be0f..3680d9a6aa0 100644 --- a/examples/solid/kitchen-sink-solid-query-file-based/src/hooks/useSessionStorage.tsx +++ b/examples/solid/kitchen-sink-solid-query-file-based/src/hooks/useSessionStorage.tsx @@ -6,9 +6,10 @@ export function useSessionStorage(key: string, initialValue: T) { stored ? JSON.parse(stored) : initialValue, ) - Solid.createEffect(() => { - sessionStorage.setItem(key, JSON.stringify(state())) - }, [state()]) + Solid.createEffect( + () => JSON.stringify(state()), + (json) => sessionStorage.setItem(key, json), + ) return [state, setState] } diff --git a/examples/solid/kitchen-sink-solid-query-file-based/src/routes/dashboard.invoices.$invoiceId.tsx b/examples/solid/kitchen-sink-solid-query-file-based/src/routes/dashboard.invoices.$invoiceId.tsx index 125ccf6ee03..628f4715071 100644 --- a/examples/solid/kitchen-sink-solid-query-file-based/src/routes/dashboard.invoices.$invoiceId.tsx +++ b/examples/solid/kitchen-sink-solid-query-file-based/src/routes/dashboard.invoices.$invoiceId.tsx @@ -38,7 +38,7 @@ function InvoiceComponent() { const updateInvoiceMutation = useUpdateInvoiceMutation(params().invoiceId) const [notes, setNotes] = Solid.createSignal(search().notes ?? '') - Solid.createEffect(() => { + Solid.createEffect(notes, () => { navigate({ search: (old) => ({ ...old, @@ -47,7 +47,7 @@ function InvoiceComponent() { replace: true, params: true, }) - }, [notes]) + }) return (
>([]) - createEffect(() => { - getNames().then(setNames) - }, []) + createEffect( + () => {}, + () => { + getNames().then(setNames) + }, + ) return (