How to properly imperatively set queryData? #7195
-
Hi, I would like to manually set the data of a query cache, then route to another page and there use useQuery to get that just set data... So this is what I am doing: On first page:
On the next page:
But data always is null. What am I doing wrong here? :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
likely, the |
Beta Was this translation helpful? Give feedback.
-
Thanks for the hint, staleTime actually was set to Infinity, but I think I simply missed the "await", also changed it to setQueryData(['cache-key'], dataObject) and now it works! |
Beta Was this translation helpful? Give feedback.
Thanks for the hint, staleTime actually was set to Infinity, but I think I simply missed the "await", also changed it to setQueryData(['cache-key'], dataObject) and now it works!