Optimistic updates without re-rendering everything?
Hi, I have a shopping cart. When a user changes the quantity of some item, I'd like to do an optimistic update along with the mutation.
If I call:
All shopping cart items are re-rendered, each component is created from scratch, scroll position is lost.
Is there any way to do the update a single property of one item without re-rendering everything?
SolidJS has a SetStore API function for fine-grained updates (see docs - tutorial and api reference). Does TanStack Query expose this function?
2 Replies
stormy-gold•2y ago
Can you open an issue for this with a little repro? I believe the solid-query adapter already mutates the resource, which should perform a reconcile and hence have a fine-grained update.
extended-salmonOP•2y ago
GitHub
Solid Query causes unnecessary rerender on every fetch when working...
Describe the bug I use Solid Query to load a list of objects. Every time Solid Query runs the query and gets a new result, everything is rendered, even if the result has not changed. It causes form...