Procházet zdrojové kódy

pass should fetch to useSWRxPageInfo

yohei0125 před 3 roky
rodič
revize
a17b71eb02

+ 4 - 1
packages/app/src/components/PageAlert/PageStaleAlert.tsx

@@ -6,7 +6,10 @@ export const PageStaleAlert = ():JSX.Element => {
   const { t } = useTranslation()
   const { data: isEnabledStaleNotification } = useIsEnabledStaleNotification();
   const { data: pageData } = useSWRxCurrentPage();
-  const { data: pageInfo } = useSWRxPageInfo(pageData?._id);
+
+  const shouldfetch = isEnabledStaleNotification;
+  const { data: pageInfo } = useSWRxPageInfo(shouldfetch ? pageData?._id : null);
+
   const contentAge = pageInfo?.contentAge;
 
   if (!isEnabledStaleNotification) {