query icon indicating copy to clipboard operation
query copied to clipboard

remove `remove` returned from `useQuery`

Open TkDodo opened this issue 3 years ago • 0 comments

context

remove removes the query from the queryCache without informing observers about it. It is best used to remove data imperatively that is no longer needed, e.g. when logging a user out.

It doesn't make much sense to do this while a query is still active, because it will just trigger a hard loading state with the next re-render. So when would you ever use the remove function returned from useQuery, because at that point, you still have an active observer ?

anecdotal twitter thread

proposal

  • remove remove in v5

TkDodo avatar Dec 23 '22 07:12 TkDodo