TanStackT
TanStack2y ago
7 replies
progressive-amaranth

`invalidateQueries` only triggers re-fetch once after reload but not afterwards

I have a table that shows data. There's an edit button for each row that opens a dialog where you can update the data of the respective row. This triggers a mutation that will invalidateQueries
onSuccess
and the dialog will be closed.

For the first time after reloading this also re-fetches the query connected to the table after invalidation. After that, when I edit data again, nothing happens. How can that be and how to fix it?

UPDATE: The source problem (I think) is that I set the queryClient within the function body because showNotification is used with is returned from a custom hook. I would like to keep this solution but do not know how
Was this page helpful?