From 171a9ca74dce9833e20f3378799b683f47d3aaf8 Mon Sep 17 00:00:00 2001 From: DorraJaouad Date: Mon, 25 Sep 2023 19:24:00 +0200 Subject: [PATCH 1/2] Refactor RightSidebar and SharedItemsTab conditions Signed-off-by: DorraJaouad --- src/components/RightSidebar/RightSidebar.vue | 11 ++------ .../SharedItems/SharedItemsTab.vue | 28 ++++++++----------- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/src/components/RightSidebar/RightSidebar.vue b/src/components/RightSidebar/RightSidebar.vue index 55c2f7ca2f9..93e876896b2 100644 --- a/src/components/RightSidebar/RightSidebar.vue +++ b/src/components/RightSidebar/RightSidebar.vue @@ -277,12 +277,7 @@ export default { this.conversationName = this.conversation.displayName } - if (newConversation.token === oldConversation.token) { - return - } - - if (this.isOneToOne) { - this.activeTab = 'shared-items' + if (newConversation.token === oldConversation.token || this.isOneToOne) { return } @@ -321,9 +316,7 @@ export default { } // In other case switch to other tabs - if (this.isOneToOne) { - this.activeTab = 'shared-items' - } else { + if (!this.isOneToOne) { this.activeTab = 'participants' } }, diff --git a/src/components/RightSidebar/SharedItems/SharedItemsTab.vue b/src/components/RightSidebar/SharedItems/SharedItemsTab.vue index cc4177c7bfb..b0c1c53b65a 100644 --- a/src/components/RightSidebar/SharedItems/SharedItemsTab.vue +++ b/src/components/RightSidebar/SharedItems/SharedItemsTab.vue @@ -164,25 +164,21 @@ export default { hasSharedItems() { return Object.keys(this.$store.getters.sharedItems(this.token)).length > 0 }, - }, - watch: { - active: { - immediate: true, - handler(newValue) { - if (newValue && this.token) { - this.getSharedItemsOverview() - } - }, + isSidebarOpen() { + return this.$store.getters.getSidebarStatus }, - token: { - immediate: true, - handler(newValue) { - if (newValue && this.active) { - this.getSharedItemsOverview() - } - }, + sharedItemsIdentifier() { + return this.token + ':' + this.active + ':' + this.isSidebarOpen + }, + }, + + watch: { + sharedItemsIdentifier() { + if (this.token && this.active && this.isSidebarOpen) { + this.getSharedItemsOverview() + } }, }, From e932eee199d1d6ca9ee3269369a023c9cf6e9a56 Mon Sep 17 00:00:00 2001 From: DorraJaouad Date: Mon, 25 Sep 2023 20:19:25 +0200 Subject: [PATCH 2/2] Add loading spinner to the sharedItemTab Signed-off-by: DorraJaouad --- .../RightSidebar/SharedItems/SharedItemsTab.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/RightSidebar/SharedItems/SharedItemsTab.vue b/src/components/RightSidebar/SharedItems/SharedItemsTab.vue index b0c1c53b65a..8f36d4d07c7 100644 --- a/src/components/RightSidebar/SharedItems/SharedItemsTab.vue +++ b/src/components/RightSidebar/SharedItems/SharedItemsTab.vue @@ -20,7 +20,8 @@ -->