mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:07:08 +00:00
Unregister notification handlers.
When leaving the Project component, all its notification handlers will be unregistered, otherwise we end up with a memory leak.
This commit is contained in:
@@ -85,10 +85,10 @@ export default {
|
||||
this.refreshSequences();
|
||||
},
|
||||
|
||||
registerNotificationHandlers () {
|
||||
registerNotificationHandlers (action = "registerHandler") {
|
||||
|
||||
|
||||
this.$store.dispatch('registerHandler', {
|
||||
this.$store.dispatch(action, {
|
||||
table: 'event',
|
||||
|
||||
handler: (context, message) => {
|
||||
@@ -97,7 +97,7 @@ export default {
|
||||
});
|
||||
|
||||
["preplot_lines", "preplot_points"].forEach( table => {
|
||||
this.$store.dispatch('registerHandler', {
|
||||
this.$store.dispatch(action, {
|
||||
table,
|
||||
|
||||
handler: (context, message) => {
|
||||
@@ -107,7 +107,7 @@ export default {
|
||||
});
|
||||
|
||||
|
||||
this.$store.dispatch('registerHandler', {
|
||||
this.$store.dispatch(action, {
|
||||
table: 'planned_lines',
|
||||
|
||||
handler: (context, message) => {
|
||||
@@ -116,7 +116,7 @@ export default {
|
||||
});
|
||||
|
||||
["raw_lines", "raw_shots", "final_lines", "final_shots"].forEach( table => {
|
||||
this.$store.dispatch('registerHandler', {
|
||||
this.$store.dispatch(action, {
|
||||
table,
|
||||
|
||||
handler: (context, message) => {
|
||||
@@ -127,6 +127,10 @@ export default {
|
||||
|
||||
},
|
||||
|
||||
unregisterNotificationHandlers () {
|
||||
return this.registerNotificationHandlers("unregisterHandler");
|
||||
},
|
||||
|
||||
...mapActions(["getProject", "refreshLines", "refreshSequences", "refreshEvents", "refreshLabels", "refreshPlan"])
|
||||
},
|
||||
|
||||
@@ -141,7 +145,12 @@ export default {
|
||||
this.refreshLabels();
|
||||
this.refreshPlan();
|
||||
}
|
||||
},
|
||||
|
||||
beforeDestroy () {
|
||||
this.unregisterNotificationHandlers();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user