File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,16 @@ export class JSONFile {
9595
},
9696
});
9797

98-
this.content = applyEdits(this.content, edits);
99-
this.host.overwrite(this.path, this.content);
100-
this._jsonAst = undefined;
98+
if (edits.length > 0) {
99+
const editedContent = applyEdits(this.content, edits);
100+
101+
// Update the file content if it changed
102+
if (editedContent !== this.content) {
103+
this.content = editedContent;
104+
this.host.overwrite(this.path, editedContent);
105+
this._jsonAst = undefined;
106+
}
107+
}
101108
}
102109

103110
remove(jsonPath: JSONPath): void {

0 commit comments

Comments
 (0)