Skip to content

Commit 50bd432

Browse files
committed
Avoid unneeded focusing of the SimpleEditor
1 parent 693bf9f commit 50bd432

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ui/frontend/editor/SimpleEditor.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { isEqual } from 'lodash-es';
12
import React from 'react';
23

34
import { CommonEditorProps, Position, Selection } from '../types';
@@ -85,7 +86,7 @@ class SimpleEditor extends React.PureComponent<CommonEditorProps> {
8586
if (!newPosition || !editor) {
8687
return;
8788
}
88-
if (newPosition === oldPosition) {
89+
if (isEqual(newPosition, oldPosition)) {
8990
return;
9091
}
9192

@@ -102,7 +103,7 @@ class SimpleEditor extends React.PureComponent<CommonEditorProps> {
102103
if (!newSelection || !newSelection.start || !newSelection.end || !editor) {
103104
return;
104105
}
105-
if (newSelection === oldSelection) {
106+
if (isEqual(newSelection, oldSelection)) {
106107
return;
107108
}
108109

0 commit comments

Comments
 (0)