Skip to content

Commit 8b21a0c

Browse files
committed
fix(files): use actual model value for additive applyEdits guard
1 parent 1956f85 commit 8b21a0c

1 file changed

Lines changed: 2 additions & 3 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: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,7 @@ export const TextEditor = memo(function TextEditor({
443443
}
444444
}
445445
suppressScrollListenerRef.current = true
446-
const prev = lastSyncedContentRef.current
447-
if (content.startsWith(prev) && prev.length < content.length) {
446+
if (content.startsWith(monacoValue) && monacoValue.length < content.length) {
448447
const lastLine = model.getLineCount()
449448
const lastCol = model.getLineMaxColumn(lastLine)
450449
model.applyEdits([
@@ -455,7 +454,7 @@ export const TextEditor = memo(function TextEditor({
455454
endLineNumber: lastLine,
456455
endColumn: lastCol,
457456
},
458-
text: content.slice(prev.length),
457+
text: content.slice(monacoValue.length),
459458
},
460459
])
461460
} else {

0 commit comments

Comments
 (0)