Skip to content

Commit

Permalink
fix: compare incoming value with modal's value
Browse files Browse the repository at this point in the history
  • Loading branch information
jin-sir committed Jun 14, 2024
1 parent 0ed42e8 commit 7cf2532
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/services/workbench/editorService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'reflect-metadata';
import { singleton, container } from 'tsyringe';
import { cloneDeep } from 'lodash';
import { cloneDeep, isString } from 'lodash';
import { Component } from 'mo/react';
import {
EditorModel,
Expand Down Expand Up @@ -337,8 +337,13 @@ export class EditorService
const model = MonacoEditor.getModel(
Uri.parse(tab.id.toString())
);
if (model) {
model.setValue(editorValue || '');
const currentValue = model?.getValue();
if (
model &&
isString(editorValue) &&
currentValue !== editorValue
) {
model.setValue(editorValue);
}
this.updateGroup(groupId, group);

Expand All @@ -362,8 +367,13 @@ export class EditorService
const model = MonacoEditor.getModel(
Uri.parse(tab.id.toString())
);
if (model) {
model.setValue(editorValue || '');
const currentValue = model?.getValue();
if (
model &&
isString(editorValue) &&
currentValue !== editorValue
) {
model.setValue(editorValue);
}
});

Expand Down

0 comments on commit 7cf2532

Please sign in to comment.