TanStackT
TanStackโ€ข3y agoโ€ข
3 replies
sacred-rose

Set query data for query with nested array query key

I have a query with queryKey: ['foo', ['bar']] which I want to update the query data for.

When I do
queryClient.setQueriesData(['foo'], ...)

it works fine (although I get queries I dont want aswell), but when I do:

queryClient.setQueriesData(['foo', ['bar']], ...)

Then it doesnt update for my query, it does not seem able to match the query keys.

I have confirmed that the query key is ['foo', ['bar']] by printing the queryClient in the browser console and looking at the queries.

Could it be a problem that the element in the querykey param is an array and not a primitive? ๐Ÿค”

I am probably doing something trivial thing wrong ๐Ÿ˜„ Any help is appreciated!
Was this page helpful?