fix(ui): NProgress not showing when mutation is running
This commit is contained in:
2 files changed
+5
-3
No files matched your search
+1
-1
@@ -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
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in new issue
Block a user