SolidJSS
SolidJSโ€ข16mo agoโ€ข
4 replies
Mr Void

disable untrack when param changes

is it possible to, again, track an untracked signal when useParams parameters changes.

I have a component that retrieves some data from the store based on a URL parameter.
const params = useParams()
const [currentNote, setCurrentNote] = createSignal<Note>()

createEffect(async () => {
    // <data from store depending on params.note_id>
    setCurrentNote(...)
})

<Editor
    // untracking to avoid bug in editor whenever data is autosaved
    // however, this needs to be updated when URL param changes
    data={untrack(() => currentNote()?.data) || undefined}
/>
Was this page helpful?