-
|
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? |
Beta Was this translation helpful? Give feedback.
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 |
Beta Was this translation helpful? Give feedback.
-
|
Here's what I used recently: const queryClient = useQueryClient();
const hasPendingBasketMutations =
queryClient.getMutationCache().findAll({
mutationKey: ["basket"],
status: "pending",
}).length > 0; |
Beta Was this translation helpful? Give feedback.
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.