|
@@ -75,10 +75,10 @@ const PageDuplicateModal = (): JSX.Element => {
|
|
|
}, [checkExistPaths]);
|
|
}, [checkExistPaths]);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- if (page != null && pageNameInput !== page.path) {
|
|
|
|
|
|
|
+ if (isOpened && page != null && pageNameInput !== page.path) {
|
|
|
checkExistPathsDebounce(page.path, pageNameInput);
|
|
checkExistPathsDebounce(page.path, pageNameInput);
|
|
|
}
|
|
}
|
|
|
- }, [pageNameInput, subordinatedPages, checkExistPathsDebounce, page]);
|
|
|
|
|
|
|
+ }, [isOpened, pageNameInput, subordinatedPages, checkExistPathsDebounce, page]);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* change pageNameInput for PagePathAutoComplete
|
|
* change pageNameInput for PagePathAutoComplete
|
|
@@ -150,22 +150,15 @@ const PageDuplicateModal = (): JSX.Element => {
|
|
|
|
|
|
|
|
}, [isOpened]);
|
|
}, [isOpened]);
|
|
|
|
|
|
|
|
- if (page == null) {
|
|
|
|
|
- return <></>;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- const { path } = page;
|
|
|
|
|
- const isTargetPageDuplicate = existingPaths.includes(pageNameInput);
|
|
|
|
|
-
|
|
|
|
|
- const submitButtonEnabled = existingPaths.length === 0
|
|
|
|
|
- || (isDuplicateRecursively && isDuplicateRecursivelyWithoutExistPath);
|
|
|
|
|
|
|
|
|
|
const bodyContent = () => {
|
|
const bodyContent = () => {
|
|
|
- if (!isOpened) {
|
|
|
|
|
|
|
+ if (!isOpened || page == null) {
|
|
|
return <></>;
|
|
return <></>;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const { path } = page;
|
|
|
|
|
+ const isTargetPageDuplicate = existingPaths.includes(pageNameInput);
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
<div className="form-group"><label>{t('modal_duplicate.label.Current page name')}</label><br />
|
|
<div className="form-group"><label>{t('modal_duplicate.label.Current page name')}</label><br />
|
|
@@ -246,10 +239,13 @@ const PageDuplicateModal = (): JSX.Element => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const footerContent = () => {
|
|
const footerContent = () => {
|
|
|
- if (!isOpened) {
|
|
|
|
|
|
|
+ if (!isOpened || page == null) {
|
|
|
return <></>;
|
|
return <></>;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const submitButtonEnabled = existingPaths.length === 0
|
|
|
|
|
+ || (isDuplicateRecursively && isDuplicateRecursivelyWithoutExistPath);
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
<ApiErrorMessageList errs={errs} targetPath={pageNameInput} />
|
|
<ApiErrorMessageList errs={errs} targetPath={pageNameInput} />
|