From 397a81b9f762b8bff2f2c694b58ccc307bbe400f Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Fri, 26 Apr 2024 11:14:25 +0100 Subject: [PATCH] fix: Delete events listening on Vue application unmount - MEED-6224 - Meeds-io/MIPs#120 Before this change, some errors are logged in Layout management UI when adding and removing the News List application multiple times. This change ensures to delete listeners on unmount and to make sure that the settings drawer is displayed even in a sticky container. --- .../main/webapp/news-list-view/components/NewsListView.vue | 6 +++--- .../components/settings/NewsSettingsDrawer.vue | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/webapp/src/main/webapp/news-list-view/components/NewsListView.vue b/webapp/src/main/webapp/news-list-view/components/NewsListView.vue index a118bd898e..2bbb3dd0dd 100644 --- a/webapp/src/main/webapp/news-list-view/components/NewsListView.vue +++ b/webapp/src/main/webapp/news-list-view/components/NewsListView.vue @@ -205,9 +205,9 @@ export default { this.retrieveNewsList().finally(() => this.$root.$applicationLoaded()); document.addEventListener(`component-${this.extensionApp}-${this.extensionType}-updated`, this.refreshViewExtensions); this.refreshViewExtensions(); - - document.addEventListener('drawerOpened', () => this.$el.closest('#stickyBlockDesktop').style.position = 'static'); - document.addEventListener('drawerClosed', () => this.$el.closest('#stickyBlockDesktop').style.position = 'sticky'); + }, + beforeDestroy() { + document.removeEventListener(`component-${this.extensionApp}-${this.extensionType}-updated`, this.refreshViewExtensions); }, methods: { retrieveNewsList() { diff --git a/webapp/src/main/webapp/news-list-view/components/settings/NewsSettingsDrawer.vue b/webapp/src/main/webapp/news-list-view/components/settings/NewsSettingsDrawer.vue index e4a9e0abc1..fd36068602 100644 --- a/webapp/src/main/webapp/news-list-view/components/settings/NewsSettingsDrawer.vue +++ b/webapp/src/main/webapp/news-list-view/components/settings/NewsSettingsDrawer.vue @@ -21,6 +21,7 @@ along with this program. If not, see . id="newsSettingsDrawer" right fixed + detached @closed="close">