فهرست منبع

update recent change when page published

nHigashiWeseek 1 سال پیش
والد
کامیت
1d6e23f091
1فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 6 1
      apps/app/src/components/PageView/PageAlerts/WipPageAlert.tsx

+ 6 - 1
apps/app/src/components/PageView/PageAlerts/WipPageAlert.tsx

@@ -3,12 +3,15 @@ import React, { useCallback } from 'react';
 import { useTranslation } from 'react-i18next';
 import { useTranslation } from 'react-i18next';
 
 
 import { useSWRMUTxCurrentPage, useSWRxCurrentPage } from '~/stores/page';
 import { useSWRMUTxCurrentPage, useSWRxCurrentPage } from '~/stores/page';
+import { useSWRINFxRecentlyUpdated } from '~/stores/page-listing';
 
 
 
 
 export const WipPageAlert = (): JSX.Element => {
 export const WipPageAlert = (): JSX.Element => {
   const { t } = useTranslation();
   const { t } = useTranslation();
   const { data: currentPage } = useSWRxCurrentPage();
   const { data: currentPage } = useSWRxCurrentPage();
   const { trigger: mutateCurrentPage } = useSWRMUTxCurrentPage();
   const { trigger: mutateCurrentPage } = useSWRMUTxCurrentPage();
+  const { mutate: mutateRecentlyUpdated } = useSWRINFxRecentlyUpdated(20, true);
+
 
 
   const clickPagePublishButton = useCallback(async() => {
   const clickPagePublishButton = useCallback(async() => {
     const pageId = currentPage?._id;
     const pageId = currentPage?._id;
@@ -28,12 +31,14 @@ export const WipPageAlert = (): JSX.Element => {
 
 
       const toastSuccess = (await import('~/client/util/toastr')).toastSuccess;
       const toastSuccess = (await import('~/client/util/toastr')).toastSuccess;
       toastSuccess(t('wip_page.success_publish_page'));
       toastSuccess(t('wip_page.success_publish_page'));
+
+      mutateRecentlyUpdated();
     }
     }
     catch {
     catch {
       const toastError = (await import('~/client/util/toastr')).toastError;
       const toastError = (await import('~/client/util/toastr')).toastError;
       toastError(t('wip_page.fail_publish_page'));
       toastError(t('wip_page.fail_publish_page'));
     }
     }
-  }, [currentPage?._id, mutateCurrentPage, t]);
+  }, [currentPage?._id, mutateCurrentPage, t, mutateRecentlyUpdated]);
 
 
 
 
   if (!currentPage?.wip) {
   if (!currentPage?.wip) {