kaori 3 лет назад
Родитель
Сommit
33a4bbd625

+ 4 - 2
packages/app/src/components/Page.jsx

@@ -12,6 +12,7 @@ import {
   useCurrentPagePath, useIsGuestUser, useCurrentPageId,
 } from '~/stores/context';
 import { useSWRxSlackChannels, useIsSlackEnabled, useStaticPageTags } from '~/stores/editor';
+import { useSWRxTagsInfo } from '~/stores/page';
 import {
   useEditorMode, useIsMobile, useSelectedGrant, useSelectedGrantGroupId, useSelectedGrantGroupName,
 } from '~/stores/ui';
@@ -191,7 +192,8 @@ const PageWrapper = (props) => {
   const { data: slackChannelsData } = useSWRxSlackChannels(currentPagePath);
   const { data: isSlackEnabled } = useIsSlackEnabled();
   const { data: pageId } = useCurrentPageId();
-  const { data: tagsInfoData } = useStaticPageTags(pageId);
+  const { data: tagsInfoData } = useSWRxTagsInfo(pageId);
+  const { data: pageTags } = useStaticPageTags(tagsInfoData?.tags);
   const { data: grant } = useSelectedGrant();
   const { data: grantGroupId } = useSelectedGrantGroupId();
   const { data: grantGroupName } = useSelectedGrantGroupName();
@@ -240,7 +242,7 @@ const PageWrapper = (props) => {
       isGuestUser={isGuestUser}
       isMobile={isMobile}
       isSlackEnabled={isSlackEnabled}
-      pageTags={tagsInfoData.tags || []}
+      pageTags={pageTags}
       slackChannels={slackChannelsData.toString()}
       grant={grant}
       grantGroupId={grantGroupId}

+ 5 - 3
packages/app/src/components/SavePageControls.jsx

@@ -16,6 +16,7 @@ import { getOptionsToSave } from '~/client/util/editor';
 // TODO: remove this when omitting unstated is completed
 import { useIsEditable, useCurrentPageId } from '~/stores/context';
 import { useStaticPageTags } from '~/stores/editor';
+import { useSWRxTagsInfo } from '~/stores/page';
 import {
   useEditorMode, useSelectedGrant, useSelectedGrantGroupId, useSelectedGrantGroupName,
 } from '~/stores/ui';
@@ -145,7 +146,8 @@ const SavePageControlsWrapper = (props) => {
   const { data: grantGroupId, mutate: mutateGrantGroupId } = useSelectedGrantGroupId();
   const { data: grantGroupName, mutate: mutateGrantGroupName } = useSelectedGrantGroupName();
   const { data: pageId } = useCurrentPageId();
-  const { data: tagsInfoData } = useStaticPageTags(pageId);
+  const { data: tagsInfoData } = useSWRxTagsInfo(pageId);
+  const { data: pageTags } = useStaticPageTags(tagsInfoData?.tags);
 
 
   if (isEditable == null || editorMode == null) {
@@ -167,7 +169,7 @@ const SavePageControlsWrapper = (props) => {
       mutateGrant={mutateGrant}
       mutateGrantGroupId={mutateGrantGroupId}
       mutateGrantGroupName={mutateGrantGroupName}
-      pageTags={tagsInfoData?.tags || []}
+      pageTags={pageTags || []}
     />
   );
 };
@@ -183,7 +185,7 @@ SavePageControls.propTypes = {
   editorMode: PropTypes.string.isRequired,
   isSlackEnabled: PropTypes.bool.isRequired,
   slackChannels: PropTypes.string.isRequired,
-  pageTags:  PropTypes.arrayOf(PropTypes.string),
+  pageTags: PropTypes.arrayOf(PropTypes.string),
   grant: PropTypes.number.isRequired,
   grantGroupId: PropTypes.string,
   grantGroupName: PropTypes.string,