Yuken Tezuka 3 лет назад
Родитель
Сommit
0afd111b45
2 измененных файлов с 4 добавлено и 5 удалено
  1. 1 1
      packages/app/src/stores/context.tsx
  2. 3 4
      packages/app/src/stores/editor.tsx

+ 1 - 1
packages/app/src/stores/context.tsx

@@ -45,7 +45,7 @@ export const useCurrentPathname = (initialData?: string): SWRResponse<string, Er
 };
 };
 
 
 export const useCurrentPageId = (initialData?: Nullable<string>): SWRResponse<Nullable<string>, Error> => {
 export const useCurrentPageId = (initialData?: Nullable<string>): SWRResponse<Nullable<string>, Error> => {
-  return useContextSWR<Nullable<string>, Error>('currentPageId', initialData);
+  return useStaticSWR<Nullable<string>, Error>('currentPageId', initialData);
 };
 };
 
 
 export const useIsIdenticalPath = (initialData?: boolean): SWRResponse<boolean, Error> => {
 export const useIsIdenticalPath = (initialData?: boolean): SWRResponse<boolean, Error> => {

+ 3 - 4
packages/app/src/stores/editor.tsx

@@ -10,17 +10,16 @@ import { IEditorSettings } from '~/interfaces/editor-settings';
 import { SlackChannels } from '~/interfaces/user-trigger-notification';
 import { SlackChannels } from '~/interfaces/user-trigger-notification';
 
 
 import {
 import {
-  useCurrentPageId,
   useCurrentUser, useDefaultIndentSize, useIsGuestUser,
   useCurrentUser, useDefaultIndentSize, useIsGuestUser,
 } from './context';
 } from './context';
 // import { localStorageMiddleware } from './middlewares/sync-to-storage';
 // import { localStorageMiddleware } from './middlewares/sync-to-storage';
-import { useSWRxTagsInfo } from './page';
+import { useCurrentPagePath, useSWRxTagsInfo } from './page';
 import { useStaticSWR } from './use-static-swr';
 import { useStaticSWR } from './use-static-swr';
 
 
 
 
 export const useEditingMarkdown = (initialData?: string): SWRResponse<string, Error> => {
 export const useEditingMarkdown = (initialData?: string): SWRResponse<string, Error> => {
-  const { data: pageId } = useCurrentPageId();
-  return useStaticSWR(['editingMarkdown', pageId], initialData);
+  const { data: currentPagePath } = useCurrentPagePath();
+  return useStaticSWR(['editingMarkdown', currentPagePath], initialData);
 };
 };