Retrigger fetcher in createResource on store change
https://playground.solidjs.com/anonymous/52b7a9be-3fe1-406a-8941-a3d0a4959bfe
As in the example, if the source argument is the whole store the fetcher in createResource wont run. How can I make it re-run if any of the store's values change
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
4 Replies
For the context I'm simulating query params as an in memory Solid store and want to refetch data on their change. Thats why I'd like to pass the store as the signal. Conveniently it also becomes the fetcher argument
In general you can't listen to all properties of a store change at the top level unless you read all of them in the tracking scope.
You can do this
https://playground.solidjs.com/anonymous/4679ff85-c4b1-451f-99e0-63243edef787
But it might be better to make use of
https://github.com/solidjs-community/solid-primitives/tree/main/packages/deep#trackstore
JSON.stringify works but that trackstore thing doesnt 😦
() => { ...store }
works too lolThat works fine if you don't have any nested properties like
{count: 0, other: {property: 'hello'}}
. Spreading won't track other.property