Skip to content

Commit 19e0a92

Browse files
committed
fix: Properly indicate save status on switching notes
Signed-off-by: Julius Härtl <[email protected]>
1 parent 48a57d6 commit 19e0a92

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/components/NoteRich.vue

+10-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export default {
4949
watch: {
5050
$route(to, from) {
5151
if (to.name !== from.name || to.params.noteId !== from.params.noteId) {
52+
this.onClose(from.params.noteId)
5253
this.fetchData()
5354
}
5455
},
@@ -96,7 +97,7 @@ export default {
9697
const title = this.getTitle(markdown)
9798
this.shouldAutotitle = this.isNewNote || (title !== '' && title === this.note.title)
9899
}
99-
this.onEdit({ content: markdown, unsaved: unsaved})
100+
this.onEdit({ content: markdown, unsaved })
100101
}
101102
},
102103
}))
@@ -112,6 +113,14 @@ export default {
112113
})
113114
},
114115
116+
onClose(noteId) {
117+
const note = store.getters.getNote(parseInt(noteId))
118+
store.commit('updateNote', {
119+
...note,
120+
unsaved: false,
121+
})
122+
},
123+
115124
fileUpdated({ fileid }) {
116125
if (this.note.id === fileid) {
117126
this.onEdit({ unsaved: false })

0 commit comments

Comments
 (0)