Currently, after running a mutation on the frontend, we use react-query's refetch function to refetch the data that was mutated. (You can see an example of this in AssignLocationDropdown.tsx.) Instead of calling the refetch, we should use react-query's invalidateQueries to mark those queries as stale in the cache. This would mean that we don't need to pass the refetch function around as a prop, and we also would only make the refetch when necessary. See this issue for more information https://github.com/TanStack/query/discussions/2468
Currently, after running a mutation on the frontend, we use react-query's
refetch
function to refetch the data that was mutated. (You can see an example of this inAssignLocationDropdown.tsx
.) Instead of calling therefetch
, we should use react-query'sinvalidateQueries
to mark those queries as stale in the cache. This would mean that we don't need to pass therefetch
function around as a prop, and we also would only make the refetch when necessary. See this issue for more information https://github.com/TanStack/query/discussions/2468