Skip to content

Commit 5fb7873

Browse files
committed
fix: CodeEditor - add debounce for diffMinimap change handler
1 parent 3a610cc commit 5fb7873

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/Common/CodeMirror/utils.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import { yamlCompletion, yamlSchemaHover, yamlSchemaLinter } from 'codemirror-js
4242

4343
import { Icon } from '@Shared/Components'
4444
import { Tooltip } from '@Common/Tooltip'
45-
import { noop, YAMLStringify } from '@Common/Helper'
45+
import { debounce, noop, YAMLStringify } from '@Common/Helper'
4646

4747
import { yamlParseLinter } from './Extensions'
4848
import { CodeEditorProps, FindReplaceToggleButtonProps, GetCodeEditorHeightReturnType, HoverTexts } from './types'
@@ -154,10 +154,16 @@ export const updateDiffMinimapValues = (view: MergeView, transactions: readonly
154154
annotations.push(Transaction.userEvent.of(userEvent))
155155
}
156156

157-
view[side].dispatch({
158-
changes: tr.changes,
159-
annotations,
160-
})
157+
const debouncedDispatch = debounce(
158+
() =>
159+
view[side].dispatch({
160+
changes: tr.changes,
161+
annotations,
162+
}),
163+
300,
164+
)
165+
166+
debouncedDispatch()
161167
}
162168
})
163169
}

0 commit comments

Comments
 (0)