Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(sync): only save on close if changes were made
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud authored and backportbot-nextcloud[bot] committed Jul 12, 2023
commit 418347f6bca44f4f54e1cc8bcbd33bf36b5377a2
6 changes: 5 additions & 1 deletion src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,17 @@ export default {
this.$syncService = null
this.$attachmentResolver = null
},
beforeDestroy() {
async beforeDestroy() {
if (!this.richWorkspace) {
window.removeEventListener('beforeprint', this.preparePrinting)
window.removeEventListener('afterprint', this.preparePrinting)
}
unsubscribe('text:image-node:add', this.onAddImageNode)
unsubscribe('text:image-node:delete', this.onDeleteImageNode)
if (this.dirty) {
const timeout = new Promise((resolve) => setTimeout(resolve, 2000))
await Promise.any([timeout, this.$syncService.save()])
}
this.$providers.forEach(p => p.destroy())
},
methods: {
Expand Down
2 changes: 0 additions & 2 deletions src/services/SyncService.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,6 @@ class SyncService {

async close() {
this.backend?.disconnect()
const timeout = new Promise((resolve) => setTimeout(resolve, 2000))
await Promise.any([timeout, this.save()])
return this._close()
}

Expand Down