Skip to content

Commit c2f1ba3

Browse files
committed
fix bug where switching project + save would save temp file for original file
1 parent 573d85e commit c2f1ba3

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/lib/documents.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ class Documents {
3030
return this.swap(filename);
3131
}
3232

33+
remove(filename){
34+
// TODO: remove something?
35+
delete this._documents[filename];
36+
}
37+
3338
swap(filename) {
3439
this._filename = filename;
3540

src/plugins/handlers.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,15 @@ function handlers(app, opts, done){
8383
}
8484

8585
function saveFile(){
86-
const { filename, content, isNew } = workspace.getState();
86+
const { filename, content, isNew, cwd } = workspace.getState();
8787

8888
if(isNew){
8989
showSaveOverlay();
9090
} else {
91-
workspace.saveFile(filename, content);
91+
workspace.saveFile(filename, content)
92+
.then(function(){
93+
documents.swap(path.join(cwd, filename));
94+
});
9295
}
9396
}
9497

@@ -98,13 +101,14 @@ function handlers(app, opts, done){
98101
}
99102

100103
const { nextFile } = store.getState();
101-
const { content } = workspace.getState();
104+
const { cwd, content } = workspace.getState();
102105

103106
workspace.updateFilename(filename)
104107
.then(function(){
105108
return workspace.saveFile(filename, content);
106109
})
107110
.then(function(){
111+
documents.swap(path.join(cwd, filename));
108112
if(nextFile){
109113
changeFile(nextFile);
110114
}

0 commit comments

Comments
 (0)