Fix a bug that caused it to jump over nodes when pressing too fast

This commit is contained in:
Dan Abramov
2019-04-10 19:30:45 +01:00
parent 6420f11d65
commit 952c8cda00
+5 -1
View File
@@ -134,7 +134,11 @@ function reduceTreeState(store: Store, state: State, action: Action): State {
const selectedElement = store.getElementAtIndex(
((selectedElementIndex: any): number)
);
if (selectedElement !== null && selectedElement.children.length > 0) {
if (
selectedElement !== null &&
selectedElement.children.length > 0 &&
!selectedElement.isCollapsed
) {
const firstChildID = selectedElement.children[0];
const firstChildIndex = store.getIndexOfElementID(firstChildID);
if (firstChildIndex !== null) {