T
TanStack4y ago
correct-apricot

Invalidate query happening too fast

After onSuccess on a mutation I invalidate a query, but if I do not give the backend enough time to update the database when the query is invalidated it gets the old stale data. For context my query is making a get request to my api, and my mutation is making a post request. The issue I am having is I invalidate the query in the onSuccess callback in the mutation, but if I do not setTimeout before invalidating the query then it pulls stale data while the backend is still updating the database. Any ideas on how to fix this?
1 Reply
correct-apricot
correct-apricotOP4y ago
Fixed it, was not awaiting one of my functions properly. Thank you for the amazing library you guys built!

Did you find this page helpful?