fix(ui): NProgress not showing when mutation is running

This commit is contained in:
Prayag Prajapati committed 2024-02-24 14:26:48 +05:30
1 parent eb482c180e
commit 455a499670
2 files changed
+5 -3

No files matched your search

+1 -1
View File
@@ -288,7 +288,7 @@ function AppReady() {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<CssBaseline /> <CssBaseline />
<NProgress <NProgress
isAnimating={isQueryFetching} isAnimating={isQueryFetching || isMutating}
key={isQueryFetching || isMutating ? "fetching" : "notFetching"} key={isQueryFetching || isMutating ? "fetching" : "notFetching"}
/> />
<Dialog <Dialog
+4 -2
View File
@@ -19,17 +19,19 @@ const MarkPlayedButton = ({ itemId, isPlayed, queryKey, userId, itemName }) => {
const { enqueueSnackbar } = useSnackbar(); const { enqueueSnackbar } = useSnackbar();
const handleMarking = async () => { const handleMarking = async () => {
let result = null;
if (!isPlayed) { if (!isPlayed) {
return await getPlaystateApi(api).markPlayedItem({ result = await getPlaystateApi(api).markPlayedItem({
userId: userId, userId: userId,
itemId: itemId, itemId: itemId,
}); });
} else if (isPlayed) { } else if (isPlayed) {
return await getPlaystateApi(api).markUnplayedItem({ result = await getPlaystateApi(api).markUnplayedItem({
userId: userId, userId: userId,
itemId: itemId, itemId: itemId,
}); });
} }
return result;
}; };
const mutation = useMutation({ const mutation = useMutation({
mutationFn: handleMarking, mutationFn: handleMarking,