|
I'd like to prevent the user from closing the app if there are currently unresolved mutations happening in the background. To do this, I'll need to be able to check for any unresolved mutations (not queries) regardless of where the user is in the app. Is there a simple way to do this? |
Answered by
TkDodo
Dec 16, 2020
Replies: 2 comments 8 replies
|
Maybe look at the query client, it might contain the information that you need and you can get it via |
8 replies
Answer selected by
narthur
|
Here's what I used recently: const queryClient = useQueryClient();
const hasPendingBasketMutations =
queryClient.getMutationCache().findAll({
mutationKey: ["basket"],
status: "pending",
}).length > 0;Edit: actually it's probably better to use |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe look at the query client, it might contain the information that you need and you can get it via
useQueryClientwhen the window is closed.