mirror of
https://github.com/outline/outline.git
synced 2026-12-02 09:42:07 +03:00
fix: Sidebar jumps when creating a document from the inline input
This commit is contained in:
2 files changed
+8
-2
No files matched your search
@@ -2,6 +2,7 @@ import type { Location, LocationDescriptor } from "history";
|
||||
import { observer } from "mobx-react";
|
||||
import { PlusIcon } from "outline-icons";
|
||||
import * as React from "react";
|
||||
import { flushSync } from "react-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { mergeRefs } from "react-merge-refs";
|
||||
import type { match } from "react-router";
|
||||
@@ -149,7 +150,9 @@ function CollectionRow({
|
||||
try {
|
||||
newChildTitleRef.current?.setIsEditing(false);
|
||||
await onCreateChild(value);
|
||||
closeAddingNewChild();
|
||||
|
||||
// Remove the input in the same paint as the new tree item.
|
||||
flushSync(closeAddingNewChild);
|
||||
} catch (_err) {
|
||||
newChildTitleRef.current?.setIsEditing(true);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { Location, LocationDescriptor } from "history";
|
||||
import { observer } from "mobx-react";
|
||||
import { PlusIcon } from "outline-icons";
|
||||
import * as React from "react";
|
||||
import { flushSync } from "react-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import type { match } from "react-router";
|
||||
import styled from "styled-components";
|
||||
@@ -194,7 +195,9 @@ function DocumentRow({
|
||||
try {
|
||||
newChildTitleRef.current?.setIsEditing(false);
|
||||
await onCreateChild(value);
|
||||
closeAddingNewChild();
|
||||
|
||||
// Remove the input in the same paint as the new tree item.
|
||||
flushSync(closeAddingNewChild);
|
||||
} catch (_err) {
|
||||
newChildTitleRef.current?.setIsEditing(true);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user