Replies: 1 comment 7 replies
-
Sure, you can use Except in you case you'll need to iterate over old items array to find item by id and replace it |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there any mechanism to relate a query for a list of items to the items themselves?
If I have query to fetch an array of items like:
useQuery('items', fetchItems)
, I assume the cache holds one entry, which is basically 'items' -> [...items].If I edit one item, instead of invalidating 'items', I'd like to only invalidate ['items', {id}] and replace with the new value (and rollback if there's an error).
In this way, I can do only one fetch to get the whole list, and individual updates only affect one item.
Is there a way I can have the fetch of an array of items get stored in cache as an array keys instead of one key?
I know I'm missing something here, but there isn't much point to invalidating a single item if I would only then refetch the entire list.
Beta Was this translation helpful? Give feedback.
All reactions