diff --git a/client/web/compose/src/components/Namespaces/Reminders/index.vue b/client/web/compose/src/components/Namespaces/Reminders/index.vue index 834ccaa4d..0aa015d9b 100644 --- a/client/web/compose/src/components/Namespaces/Reminders/index.vue +++ b/client/web/compose/src/components/Namespaces/Reminders/index.vue @@ -46,7 +46,7 @@ export default { }), }, - created () { + mounted () { this.fetchReminders() // @todo remove this, when sockets get implemented this.$root.$on('reminders.pull', this.fetchReminders) diff --git a/client/web/compose/src/components/PageBlocks/TabsConfigurator.vue b/client/web/compose/src/components/PageBlocks/TabsConfigurator.vue index 01e9fcdde..9850711ee 100644 --- a/client/web/compose/src/components/PageBlocks/TabsConfigurator.vue +++ b/client/web/compose/src/components/PageBlocks/TabsConfigurator.vue @@ -307,11 +307,11 @@ export default { }, }, - created () { + mounted () { this.$root.$on('builder-createRequestFulfilled', this.createRequestFulfilled) }, - destroyed () { + beforeDestroy () { this.$root.$off('builder-createRequestFulfilled', this.createRequestFulfilled) }, diff --git a/client/web/compose/src/components/Public/Page/Block/Modal.vue b/client/web/compose/src/components/Public/Page/Block/Modal.vue index d85b62dc9..ee5ad3cdd 100644 --- a/client/web/compose/src/components/Public/Page/Block/Modal.vue +++ b/client/web/compose/src/components/Public/Page/Block/Modal.vue @@ -104,11 +104,11 @@ export default { }, }, - created () { + mounted () { this.$root.$on('magnify-page-block', this.magnifyPageBlock) }, - destroyed () { + beforeDestroy () { this.$root.$off('magnify-page-block', this.magnifyPageBlock) }, diff --git a/client/web/compose/src/components/Public/Record/Modal.vue b/client/web/compose/src/components/Public/Record/Modal.vue index aa81997fb..9ff74a7f9 100644 --- a/client/web/compose/src/components/Public/Record/Modal.vue +++ b/client/web/compose/src/components/Public/Record/Modal.vue @@ -124,7 +124,7 @@ export default { }, }, - created () { + mounted () { this.$root.$on('show-record-modal', ({ recordID, recordPageID }) => { this.$router.push({ query: { diff --git a/client/web/compose/src/views/Admin/Pages/Builder.vue b/client/web/compose/src/views/Admin/Pages/Builder.vue index 9011a3993..1ab4018a6 100644 --- a/client/web/compose/src/views/Admin/Pages/Builder.vue +++ b/client/web/compose/src/views/Admin/Pages/Builder.vue @@ -456,16 +456,13 @@ export default { }, }, - created () { + mounted () { + window.addEventListener('paste', this.pasteBlock) this.$root.$on('tab-editRequest', this.fulfilEditRequest) this.$root.$on('tab-createRequest', this.fulfilCreateRequest) this.$root.$on('tabChange', this.untabBlock) }, - mounted () { - window.addEventListener('paste', this.pasteBlock) - }, - beforeRouteUpdate (to, from, next) { this.checkUnsavedBlocks(next) }, @@ -474,7 +471,7 @@ export default { this.checkUnsavedBlocks(next) }, - destroyed () { + beforeDestroy () { window.removeEventListener('paste', this.pasteBlock) this.$root.$off('tab-editRequest', this.fulfilEditRequest) this.$root.$off('tab-createRequest', this.fulfilCreateRequest) diff --git a/client/web/compose/src/views/Public/Pages/Records/View.vue b/client/web/compose/src/views/Public/Pages/Records/View.vue index 9c442359a..7447b8519 100644 --- a/client/web/compose/src/views/Public/Pages/Records/View.vue +++ b/client/web/compose/src/views/Public/Pages/Records/View.vue @@ -252,7 +252,7 @@ export default { }, }, - created () { + mounted () { this.$root.$on('refetch-record-blocks', () => { // Don*t refresh when creating and prompt user before refreshing when editing if (this.inCreating || (this.inEditing && !window.confirm(this.$t('notification:record.staleDataRefresh')))) { @@ -265,6 +265,10 @@ export default { }) }, + beforeDestroy () { + this.$root.$off('refetch-record-blocks') + }, + // Destroy event before route leave to ensure it doesn't destroy the newly created one beforeRouteLeave (to, from, next) { this.$root.$off('refetch-record-blocks') diff --git a/client/web/compose/src/views/Public/Pages/View.vue b/client/web/compose/src/views/Public/Pages/View.vue index d3945f2dc..ec42d6850 100644 --- a/client/web/compose/src/views/Public/Pages/View.vue +++ b/client/web/compose/src/views/Public/Pages/View.vue @@ -192,7 +192,7 @@ export default { }, }, - created () { + mounted () { this.$root.$on('refetch-records', () => { // If on a record page, let it take care of events else just refetch non record-blocks (that use records) this.$root.$emit(this.page.moduleID !== NoID ? 'refetch-record-blocks' : `refetch-non-record-blocks:${this.page.pageID}`)