Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ export function useSessionStorage<T>(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]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -47,7 +47,7 @@ function InvoiceComponent() {
replace: true,
params: true,
})
}, [notes])
})

return (
<form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ export const Route = createFileRoute('/demo/start/api-request')({
function Home() {
const [names, setNames] = createSignal<Array<string>>([])

createEffect(() => {
getNames().then(setNames)
}, [])
createEffect(
() => {},
() => {
getNames().then(setNames)
},
)

return (
<div
Expand Down
Loading