|
|
|
|
|
by fabian2k
977 days ago
|
|
It was more of a general misunderstanding on how React Query is supposed to work, partially triggered by some mistakes in defining the query keys that meant that React Query didn't work as intended. I'd recommend this blog post (or actually all blog posts on React query on that site): https://tkdodo.eu/blog/effective-react-query-keys What I observed was that the query keys were not consistently defined, which broke automatic refetching when the data was modified and invalidated. So the developer added some manual refetches because they thought React Query couldn't handle that automatically. You need a consistent structure for your query keys and use that everywhere. Then you only need to make sure to invalidate the correct part of the query key hierarchy and the rest works automatically. |
|