Invalidate queries still requires hard refresh #3922
-
Hello! I am invalidating a query after preforming an action on the database in my app. This action results in new data and so I invalidate the specific query but I still have to do a hard refresh to see the data. This is an issue as the user would have to know to refresh the page to see the new data. I am using next js and have my app wrapped in a the query client. I can post my code below app.js
hook file
and then the invalidate line
please let me know if you see anything I am doing wrong! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
it shouldn't be necessary to perform a hard refresh. can you show a codesandbox reproduction of your problem? |
Beta Was this translation helpful? Give feedback.
-
@TkDodo thanks for the response! I think I might have something configured incorrectly. Other areas of my app work correctly when the query is invalidated. I am invalidating the query on a different next js page than where the query lives. Could it be there is a new query client created? Does query invalidation have to happen on the same next js page you are viewing the data in? |
Beta Was this translation helpful? Give feedback.
-
my axios headers are: invalidating queries from another component works on initial load. But when hot reloading invalidating queries no longer works i need to refresh browser? any ideas? EDIT: found out the fix for my problem my queryClient was being instantiated inside of a component |
Beta Was this translation helpful? Give feedback.
it shouldn't be necessary to perform a hard refresh. can you show a codesandbox reproduction of your problem?