Skip to content

Commit 9666c26

Browse files
committed
[#1887][#1890] Swap Codemirror doc when file id changes rather than file content
1 parent 998a0eb commit 9666c26

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

client/modules/IDE/components/Editor.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,7 @@ class Editor extends React.Component {
212212
}
213213

214214
componentDidUpdate(prevProps) {
215-
if (
216-
this.props.file.content !== prevProps.file.content &&
217-
this.props.file.content !== this._cm.getValue()
218-
) {
215+
if (this.props.file.id !== prevProps.file.id) {
219216
const oldDoc = this._cm.swapDoc(this._docs[this.props.file.id]);
220217
this._docs[prevProps.file.id] = oldDoc;
221218
this._cm.focus();

0 commit comments

Comments
 (0)