Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVinicius Reis <vinicius.reis@nextcloud.com>2022-07-14 18:59:11 +0300
committerVinicius Reis (Rebase PR Action) <luiz.vinicius73@gmail.com>2022-07-19 15:05:09 +0300
commit0c570513b0278c139564b035935d9cd32eed013a (patch)
treef05303e72851275840f191d0777a91c1c7072de4 /src
parent6390dd9ea08a020b586f18b8b449bbb621fbea40 (diff)
⚡️ (#2381): unsubscribe workspace events before destroy component
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
Diffstat (limited to 'src')
-rw-r--r--src/views/RichWorkspace.vue24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/views/RichWorkspace.vue b/src/views/RichWorkspace.vue
index d7688fa79..f2aff22b4 100644
--- a/src/views/RichWorkspace.vue
+++ b/src/views/RichWorkspace.vue
@@ -54,7 +54,7 @@
<script>
import axios from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
-import { subscribe } from '@nextcloud/event-bus'
+import { subscribe, unsubscribe } from '@nextcloud/event-bus'
const IS_PUBLIC = !!(document.getElementById('isPublic'))
const WORKSPACE_URL = generateOcsUrl('apps/text' + (IS_PUBLIC ? '/public' : '') + '/workspace', 2)
@@ -103,17 +103,16 @@ export default {
}
},
},
- async mounted() {
+ mounted() {
if (this.enabled) {
this.getFileInfo()
}
- subscribe('Text::showRichWorkspace', () => {
- this.enabled = true
- this.getFileInfo()
- })
- subscribe('Text::hideRichWorkspace', () => {
- this.enabled = false
- })
+ subscribe('Text::showRichWorkspace', this.showRichWorkspace)
+ subscribe('Text::hideRichWorkspace', this.hideRichWorkspace)
+ },
+ beforeDestroy() {
+ unsubscribe('Text::showRichWorkspace', this.showRichWorkspace)
+ unsubscribe('Text::hideRichWorkspace', this.hideRichWorkspace)
},
methods: {
unfocus() {
@@ -179,6 +178,13 @@ export default {
console.warn(err)
})
},
+ showRichWorkspace() {
+ this.enabled = true
+ this.getFileInfo()
+ },
+ hideRichWorkspace() {
+ this.enabled = false
+ },
},
}
</script>