-
In my app, I have a query to fetch a list of items. The query key includes some query params to control pagination and filtering, which looks like this: useQuery(['items', {offset: 0, limit: 100, ordering: ["-created_on"], ... I also have an item detail view which makes a query like this: useQuery(['item', id], ... Usually the data I need for the single item will already be a part of the cached list data. Based on this doc, I would expect to be able to do something like this: useQuery(['item', id], ..., {initialData: queryClient.getQueryData('items').find(item => item.id === id)} However, It really doesn't matter to me which page the data was on; I just want to search through the most recent query with a key that starts with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Found the solution from #420 (comment), using a filter: queryClient.getQueryData('items', {exact: false}) |
Beta Was this translation helpful? Give feedback.
Found the solution from #420 (comment), using a filter: