Fix some events not being registered/unregistered properly when switching views
This commit is contained in:
@@ -46,7 +46,7 @@ export default {
|
||||
}),
|
||||
},
|
||||
|
||||
created () {
|
||||
mounted () {
|
||||
this.fetchReminders()
|
||||
// @todo remove this, when sockets get implemented
|
||||
this.$root.$on('reminders.pull', this.fetchReminders)
|
||||
|
||||
@@ -307,11 +307,11 @@ export default {
|
||||
},
|
||||
},
|
||||
|
||||
created () {
|
||||
mounted () {
|
||||
this.$root.$on('builder-createRequestFulfilled', this.createRequestFulfilled)
|
||||
},
|
||||
|
||||
destroyed () {
|
||||
beforeDestroy () {
|
||||
this.$root.$off('builder-createRequestFulfilled', this.createRequestFulfilled)
|
||||
},
|
||||
|
||||
|
||||
@@ -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)
|
||||
},
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ export default {
|
||||
},
|
||||
},
|
||||
|
||||
created () {
|
||||
mounted () {
|
||||
this.$root.$on('show-record-modal', ({ recordID, recordPageID }) => {
|
||||
this.$router.push({
|
||||
query: {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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}`)
|
||||
|
||||
Reference in New Issue
Block a user