Skip to content

Commit 5156862

Browse files
committed
Use object identity for simple editor position checks
We already use object identity for this prop with Ace (and Redux helps us keep it stable) and this allows a person to click the link a second time and get the code re-selected. Since the prop doesn't change value, the second click does nothing with a value-based test.
1 parent b5353e6 commit 5156862

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ui/frontend/editor/SimpleEditor.tsx

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

43
import { CommonEditorProps, Position, Selection } from '../types';
@@ -87,7 +86,7 @@ class SimpleEditor extends React.PureComponent<CommonEditorProps> {
8786
if (!newPosition || !editor) {
8887
return;
8988
}
90-
if (isEqual(newPosition, oldPosition)) {
89+
if (newPosition === oldPosition) {
9190
return;
9291
}
9392

@@ -104,7 +103,7 @@ class SimpleEditor extends React.PureComponent<CommonEditorProps> {
104103
if (!newSelection || !newSelection.start || !newSelection.end || !editor) {
105104
return;
106105
}
107-
if (isEqual(newSelection, oldSelection)) {
106+
if (newSelection === oldSelection) {
108107
return;
109108
}
110109

0 commit comments

Comments
 (0)