Explorar el Código

mutate currentPage after fetching old revision data

Yuki Takei hace 1 año
padre
commit
5525e117bb
Se han modificado 1 ficheros con 8 adiciones y 1 borrados
  1. 8 1
      apps/app/src/stores/page.tsx

+ 8 - 1
apps/app/src/stores/page.tsx

@@ -139,7 +139,14 @@ export const useSWRMUTxCurrentPage = (): SWRMutationResponse<IPagePopulatedToSho
   return useSWRMutation(
     key,
     () => apiv3Get<{ page: IPagePopulatedToShowRevision }>('/page', { pageId: currentPageId, shareLinkId, revisionId })
-      .then(result => result.data.page)
+      .then((result) => {
+        const newData = result.data.page;
+
+        // for the issue https://redmine.weseek.co.jp/issues/156150
+        mutate('currentPage', newData, false);
+
+        return newData;
+      })
       .catch(getPageApiErrorHandler),
     {
       populateCache: true,