|
@@ -5,7 +5,10 @@ import { SubscriptionStatusType } from '@growi/core';
|
|
|
import urljoin from 'url-join';
|
|
import urljoin from 'url-join';
|
|
|
|
|
|
|
|
import { useEditingMarkdown, usePageTagsForEditors } from '~/stores/editor';
|
|
import { useEditingMarkdown, usePageTagsForEditors } from '~/stores/editor';
|
|
|
-import { useCurrentPageId, useSWRMUTxCurrentPage, useSWRxTagsInfo } from '~/stores/page';
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ useCurrentPageId, useSWRMUTxCurrentPage, useSWRxApplicableGrant, useSWRxTagsInfo,
|
|
|
|
|
+ useSWRxCurrentGrantData,
|
|
|
|
|
+} from '~/stores/page';
|
|
|
import { useSetRemoteLatestPageData } from '~/stores/remote-latest-page';
|
|
import { useSetRemoteLatestPageData } from '~/stores/remote-latest-page';
|
|
|
import loggerFactory from '~/utils/logger';
|
|
import loggerFactory from '~/utils/logger';
|
|
|
|
|
|
|
@@ -99,6 +102,8 @@ export const useUpdateStateAfterSave = (pageId: string|undefined|null, opts?: Up
|
|
|
const { mutate: mutateTagsInfo } = useSWRxTagsInfo(pageId);
|
|
const { mutate: mutateTagsInfo } = useSWRxTagsInfo(pageId);
|
|
|
const { sync: syncTagsInfoForEditor } = usePageTagsForEditors(pageId);
|
|
const { sync: syncTagsInfoForEditor } = usePageTagsForEditors(pageId);
|
|
|
const { mutate: mutateEditingMarkdown } = useEditingMarkdown();
|
|
const { mutate: mutateEditingMarkdown } = useEditingMarkdown();
|
|
|
|
|
+ const { mutate: mutateCurrentGrantData } = useSWRxCurrentGrantData(pageId);
|
|
|
|
|
+ const { mutate: mutateApplicableGrant } = useSWRxApplicableGrant(pageId);
|
|
|
|
|
|
|
|
// update swr 'currentPageId', 'currentPage', remote states
|
|
// update swr 'currentPageId', 'currentPage', remote states
|
|
|
return useCallback(async() => {
|
|
return useCallback(async() => {
|
|
@@ -121,6 +126,9 @@ export const useUpdateStateAfterSave = (pageId: string|undefined|null, opts?: Up
|
|
|
mutateEditingMarkdown(updatedPage.revision.body);
|
|
mutateEditingMarkdown(updatedPage.revision.body);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ mutateCurrentGrantData();
|
|
|
|
|
+ mutateApplicableGrant();
|
|
|
|
|
+
|
|
|
const remoterevisionData = {
|
|
const remoterevisionData = {
|
|
|
remoteRevisionId: updatedPage.revision._id,
|
|
remoteRevisionId: updatedPage.revision._id,
|
|
|
remoteRevisionBody: updatedPage.revision.body,
|
|
remoteRevisionBody: updatedPage.revision.body,
|
|
@@ -131,7 +139,7 @@ export const useUpdateStateAfterSave = (pageId: string|undefined|null, opts?: Up
|
|
|
setRemoteLatestPageData(remoterevisionData);
|
|
setRemoteLatestPageData(remoterevisionData);
|
|
|
},
|
|
},
|
|
|
// eslint-disable-next-line max-len
|
|
// eslint-disable-next-line max-len
|
|
|
- [pageId, mutateTagsInfo, syncTagsInfoForEditor, mutateCurrentPageId, mutateCurrentPage, opts?.supressEditingMarkdownMutation, setRemoteLatestPageData, mutateEditingMarkdown]);
|
|
|
|
|
|
|
+ [pageId, mutateTagsInfo, syncTagsInfoForEditor, mutateCurrentPageId, mutateCurrentPage, opts?.supressEditingMarkdownMutation, mutateCurrentGrantData, mutateApplicableGrant, setRemoteLatestPageData, mutateEditingMarkdown]);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export const unlink = async(path: string): Promise<void> => {
|
|
export const unlink = async(path: string): Promise<void> => {
|