jam411 3 лет назад
Родитель
Сommit
01bf5b41ed
1 измененных файлов с 8 добавлено и 3 удалено
  1. 8 3
      packages/app/src/components/PageComment/CommentEditor.tsx

+ 8 - 3
packages/app/src/components/PageComment/CommentEditor.tsx

@@ -9,8 +9,8 @@ import {
 import * as toastr from 'toastr';
 
 import { apiPostForm } from '~/client/util/apiv1-client';
-import { CustomWindow } from '~/interfaces/global';
-import { IInterceptorManager } from '~/interfaces/interceptor-manager';
+// import { CustomWindow } from '~/interfaces/global';
+// import { IInterceptorManager } from '~/interfaces/interceptor-manager';
 import { RendererOptions } from '~/services/renderer/renderer';
 import { useSWRxPageComment } from '~/stores/comment';
 import {
@@ -238,7 +238,12 @@ export const CommentEditor = (props: PropsType): JSX.Element => {
     }
   }, [apiErrorHandler, currentPageId, currentPagePath]);
 
+
   const getCommentHtml = useCallback(() => {
+    if (currentPagePath == null) {
+      return <></>;
+    }
+
     return (
       <CommentPreview
         rendererOptions={rendererOptions}
@@ -246,7 +251,7 @@ export const CommentEditor = (props: PropsType): JSX.Element => {
         currentPagePath={currentPagePath}
       />
     );
-  }, [markdown]);
+  }, [currentPagePath, markdown, rendererOptions]);
 
   const renderBeforeReady = useCallback((): JSX.Element => {
     return (