From 2b7ff48bcd524eb9ea131c2fa6f1f6502a26058d Mon Sep 17 00:00:00 2001 From: Pavel Kuzmin Date: Wed, 29 Mar 2023 06:29:15 +0500 Subject: [PATCH] fix: Turn off FOCUS_CUSTOM_ATTRIBUTE event to avoid memory leak (#6772) --- .../dashboard/components/CustomAttribute.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/javascript/dashboard/components/CustomAttribute.vue b/app/javascript/dashboard/components/CustomAttribute.vue index b9b769c44..80d5da911 100644 --- a/app/javascript/dashboard/components/CustomAttribute.vue +++ b/app/javascript/dashboard/components/CustomAttribute.vue @@ -218,13 +218,17 @@ export default { }, mounted() { this.editedValue = this.formattedValue; - bus.$on(BUS_EVENTS.FOCUS_CUSTOM_ATTRIBUTE, focusAttributeKey => { + bus.$on(BUS_EVENTS.FOCUS_CUSTOM_ATTRIBUTE, this.onFocusAttribute); + }, + destroyed() { + bus.$off(BUS_EVENTS.FOCUS_CUSTOM_ATTRIBUTE, this.onFocusAttribute); + }, + methods: { + onFocusAttribute(focusAttributeKey) { if (this.attributeKey === focusAttributeKey) { this.onEdit(); } - }); - }, - methods: { + }, focusInput() { if (this.$refs.inputfield) { this.$refs.inputfield.focus();