Просмотр исходного кода

add a conditional branch to the useEffect

WNomunomu 1 год назад
Родитель
Сommit
2d6dc9d8f6
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      apps/app/src/components/PageHeader/PageTitleHeader.tsx

+ 2 - 2
apps/app/src/components/PageHeader/PageTitleHeader.tsx

@@ -11,7 +11,7 @@ import { useTranslation } from 'next-i18next';
 
 import type { InputValidationResult } from '~/client/util/use-input-validator';
 import { ValidationTarget, useInputValidator } from '~/client/util/use-input-validator';
-import { useEditorMode } from '~/stores/ui';
+import { EditorMode, useEditorMode } from '~/stores/ui';
 
 import { CopyDropdown } from '../Common/CopyDropdown';
 import { AutosizeSubmittableInput, getAdjustedMaxWidthForAutosizeInput } from '../Common/SubmittableInput';
@@ -96,7 +96,7 @@ export const PageTitleHeader = (props: Props): JSX.Element => {
 
   useEffect(() => {
     setEditedPagePath(currentPagePath);
-    if (isNewlyCreatedPage) {
+    if (isNewlyCreatedPage && editorMode === EditorMode.Editor) {
       setRenameInputShown(true);
     }
   }, [currentPage._id, currentPagePath, isNewlyCreatedPage, editorMode]);