Skip to content

Commit 1b76937

Browse files
committed
fix(files): revert to applyEdits to avoid polluting undo stack during streaming
1 parent 00ef26b commit 1b76937

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/files/components/file-viewer

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/text-editor.tsx

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -446,27 +446,19 @@ export const TextEditor = memo(function TextEditor({
446446
if (content.startsWith(monacoValue) && monacoValue.length < content.length) {
447447
const lastLine = model.getLineCount()
448448
const lastCol = model.getLineMaxColumn(lastLine)
449-
model.pushEditOperations(
450-
null,
451-
[
452-
{
453-
range: {
454-
startLineNumber: lastLine,
455-
startColumn: lastCol,
456-
endLineNumber: lastLine,
457-
endColumn: lastCol,
458-
},
459-
text: content.slice(monacoValue.length),
449+
model.applyEdits([
450+
{
451+
range: {
452+
startLineNumber: lastLine,
453+
startColumn: lastCol,
454+
endLineNumber: lastLine,
455+
endColumn: lastCol,
460456
},
461-
],
462-
() => null
463-
)
457+
text: content.slice(monacoValue.length),
458+
},
459+
])
464460
} else {
465-
model.pushEditOperations(
466-
null,
467-
[{ range: model.getFullModelRange(), text: content }],
468-
() => null
469-
)
461+
model.applyEdits([{ range: model.getFullModelRange(), text: content }])
470462
}
471463
suppressScrollListenerRef.current = false
472464
lastSyncedContentRef.current = content

0 commit comments

Comments
 (0)