Does anyone else find it annoying that you can't pass a store as a source signal for createResource?
I have a complex request to pass into the body of a POST request to an API. It has many different nested properties of various depths. I store the request in a solid createStore in the app, so I can efficently set it thoughout my app. But to make this system reactive, so Solid refetches content you have to pull off indvidual signals. I had to build a
recursiveFlattener
helper function to make it work so if I change any property in the request it refetches. Am I doing something wrong or is that annoying to anyone else. Shouldn't it be something that the compiler can take care of?
Also, maybe a separate post but what's the right way to diff the large response from the resource in the right way? I see helpers like reconcile
do I need that? Is there a better example than the docs? What if I needed optimistic updates? What if I need to do an infinite scroll like twitter? Just use solidQuery?1 Reply
afaik this is already possible w the
storage
option in createResource
: https://www.solidjs.com/docs/latest#createresource
and as you can see, it also uses reconcile
to diff the newly fetched data with the old data. reconcile
is definitely the way to go.