TanStackT
TanStack2y ago
10 replies
brilliant-lime

HMR/Vite hot code reload clears entire cache

I'm using react-query in a pretty standard vite/react. I was having issues when updating the query cache using
setQueryData
after running a mutation, so I used the dev tools to look at the query data. It seems like after every Hot Module Reload triggered by vite, the entire query cache is wiped, and even though my interface still displays the data, calls to
setQueryData
will no longer affect it (oldData, the first argument to the update function, is always
undefined
, even if the data is currently being displayed on screen), and the devtools won't show any queries in the cache at all.

I haven't found any information about how this is supposed to work - is this expected behavior or am I missing something? I can provide more data about my setup and configuration files if needed, but it's pretty much taken straight from the examples.
Was this page helpful?