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