fix(sqllab): race condition when updating same cursor position (#30141)
This commit is contained in:
parent
ff449ad8ab
commit
880d634dc8
|
|
@ -142,9 +142,15 @@ const AceEditorWrapper = ({
|
|||
|
||||
currentSelectionCache.current = selectedText;
|
||||
});
|
||||
|
||||
editor.selection.on('changeCursor', () => {
|
||||
const cursor = editor.getCursorPosition();
|
||||
onCursorPositionChange(cursor);
|
||||
const { row, column } = cursorPosition;
|
||||
// Prevent a maximum update depth exceeded error
|
||||
// by skipping repeated updates to the same cursor position
|
||||
if (cursor.row !== row && cursor.column !== column) {
|
||||
onCursorPositionChange(cursor);
|
||||
}
|
||||
});
|
||||
|
||||
const { row, column } = cursorPosition;
|
||||
|
|
|
|||
Loading…
Reference in New Issue