Polling & optimistic updates
I wonder if there is a best practice when combining polling & optimistic updates. Below an example I found in the react-query course (ui.dev):
What happens if a
1) Just before
2) Just after
3) ...?
I just wonder if there is a some pattern when dealing with this scenario.
What happens if a
refetchInterval of 5 seconds is added to the useQuery of useTodos and that interval is triggered:1) Just before
useToggleTodo is triggered, will cancelQueries also work here?2) Just after
cancelQueries from useToggleTodo ran, will the polled useTodos data overwrite the optimistic update?3) ...?
I just wonder if there is a some pattern when dealing with this scenario.