Yuki Takei 4 лет назад
Родитель
Сommit
5e5b093122

+ 2 - 2
packages/app/src/components/Sidebar/CustomSidebar.tsx

@@ -2,7 +2,7 @@ import React, { FC } from 'react';
 
 import AppContainer from '~/client/services/AppContainer';
 import loggerFactory from '~/utils/logger';
-import { useSWRxPage } from '~/stores/page';
+import { useSWRxPageByPath } from '~/stores/page';
 
 import { withUnstatedContainers } from '../UnstatedUtils';
 import RevisionRenderer from '../Page/RevisionRenderer';
@@ -30,7 +30,7 @@ const CustomSidebar: FC<Props> = (props: Props) => {
 
   const renderer = appContainer.getRenderer('sidebar');
 
-  const { data: page, mutate } = useSWRxPage('/Sidebar');
+  const { data: page, mutate } = useSWRxPageByPath('/Sidebar');
 
   const isLoading = page === undefined;
   const markdown = page?.revision?.body;

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

@@ -6,7 +6,7 @@ import { IPage } from '~/interfaces/page';
 import { IPagingResult } from '~/interfaces/paging-result';
 
 
-export const useSWRxPage = (path: string, initialData?: IPage): SWRResponse<IPage, Error> => {
+export const useSWRxPageByPath = (path: string, initialData?: IPage): SWRResponse<IPage, Error> => {
   return useSWR(
     ['/page', path],
     (endpoint, path) => apiv3Get(endpoint, { path }).then(result => result.data.page),