|
|
@@ -241,7 +241,11 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
|
|
|
const onClickPlusButton = useCallback(() => {
|
|
|
setNewPageInputShown(true);
|
|
|
- }, []);
|
|
|
+
|
|
|
+ if (hasDescendants) {
|
|
|
+ setIsOpen(true);
|
|
|
+ }
|
|
|
+ }, [hasDescendants]);
|
|
|
|
|
|
const duplicateMenuItemClickHandler = useCallback((): void => {
|
|
|
if (onClickDuplicateMenuItem == null) {
|
|
|
@@ -337,9 +341,6 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- // force open
|
|
|
- setIsOpen(true);
|
|
|
-
|
|
|
setCreating(true);
|
|
|
|
|
|
await apiv3Post('/pages/', {
|
|
|
@@ -350,6 +351,8 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
createFromPageTree: true,
|
|
|
});
|
|
|
|
|
|
+ setCreating(false);
|
|
|
+
|
|
|
mutateChildren();
|
|
|
|
|
|
toastSuccess(t('successfully_saved_the_page'));
|
|
|
@@ -357,11 +360,6 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
catch (err) {
|
|
|
toastError(err);
|
|
|
}
|
|
|
- finally {
|
|
|
- setTimeout(() => {
|
|
|
- setCreating(false);
|
|
|
- }, 500);
|
|
|
- }
|
|
|
};
|
|
|
|
|
|
const inputValidator = (title: string | null): AlertInfo | null => {
|