diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx index 80ccc6ed1..c77a7daf1 100644 --- a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx +++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx @@ -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;