fix(editor): Fix memory leak in Node Detail View by correctly unsubscribing from event buses (#6021)

This commit is contained in:
OlegIvaniv
2023-04-20 12:26:14 +02:00
committed by GitHub
parent 41660d9e28
commit 0970ec066d
13 changed files with 98 additions and 97 deletions

View File

@@ -92,15 +92,10 @@ export default mixins(showMessage).extend({
deepCopy(defaultMessageEventBusDestinationOptions),
this.destination,
);
this.eventBus.on('destinationWasSaved', () => {
const updatedDestination = this.logStreamingStore.getDestination(this.destination.id);
if (updatedDestination) {
this.nodeParameters = Object.assign(
deepCopy(defaultMessageEventBusDestinationOptions),
this.destination,
);
}
});
this.eventBus?.on('destinationWasSaved', this.onDestinationWasSaved);
},
destroyed() {
this.eventBus?.off('destinationWasSaved', this.onDestinationWasSaved);
},
computed: {
...mapStores(useLogStreamingStore),
@@ -124,6 +119,15 @@ export default mixins(showMessage).extend({
},
},
methods: {
onDestinationWasSaved() {
const updatedDestination = this.logStreamingStore.getDestination(this.destination.id);
if (updatedDestination) {
this.nodeParameters = Object.assign(
deepCopy(defaultMessageEventBusDestinationOptions),
this.destination,
);
}
},
async onClick(event?: PointerEvent) {
if (
event &&