Skip to content

Commit

Permalink
mutate currentPage after fetching old revision data
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-takei committed Oct 23, 2024
1 parent 14fd449 commit 5525e11
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/app/src/stores/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5525e11

Please sign in to comment.