فهرست منبع

fix lint errors

Yuki Takei 2 سال پیش
والد
کامیت
cb172f11ce
2فایلهای تغییر یافته به همراه2 افزوده شده و 8 حذف شده
  1. 1 4
      apps/app/src/client/services/page-operation.ts
  2. 1 4
      apps/app/src/stores/admin/customize.tsx

+ 1 - 4
apps/app/src/client/services/page-operation.ts

@@ -165,10 +165,7 @@ export const useSaveOrUpdate = (): SaveOrUpdateFunction => {
       res = await updatePage(pageId, revisionId, markdown, options);
       res = await updatePage(pageId, revisionId, markdown, options);
     }
     }
 
 
-    // The updateFn should be a promise or asynchronous function to handle the remote mutation
-    // it should return updated data. see: https://swr.vercel.app/docs/mutation#optimistic-updates
-    // Moreover, `async() => false` does not work since it's too fast to be calculated.
-    await mutateIsEnabledUnsavedWarning(new Promise(r => setTimeout(() => r(false), 10)), { optimisticData: () => false });
+    mutateIsEnabledUnsavedWarning(false);
 
 
     return res;
     return res;
   }, [mutateIsEnabledUnsavedWarning]);
   }, [mutateIsEnabledUnsavedWarning]);

+ 1 - 4
apps/app/src/stores/admin/customize.tsx

@@ -49,10 +49,7 @@ export const useSWRxGrowiThemeSetting = (): SWRResponse<IResGrowiTheme, Error> &
     }
     }
 
 
     const newData = { ...swrResponse.data, currentTheme: theme };
     const newData = { ...swrResponse.data, currentTheme: theme };
-    // The updateFn should be a promise or asynchronous function to handle the remote mutation
-    // it should return updated data. see: https://swr.vercel.app/docs/mutation#optimistic-updates
-    // Moreover, `async() => false` does not work since it's too fast to be calculated.
-    await swrResponse.mutate(new Promise(r => setTimeout(() => r(newData), 10)), { optimisticData: () => newData });
+    swrResponse.mutate(newData, { optimisticData: newData });
   };
   };
 
 
   return Object.assign(
   return Object.assign(