diff options
author | marco <marcoambrosini@pm.me> | 2021-06-16 08:07:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-16 08:07:45 +0100 |
commit | c632941de4f01ed0a92f9ff6b7da4d4aa28c5552 (patch) | |
tree | 390ee9a3bc5caff13ee7d28afec6f6a720563e4e /src/components | |
parent | 3a313cd858fcf418d951b830b45a965583807d72 (diff) | |
parent | 10e241082b106915fe26696dd2cd809a9992cf26 (diff) |
Merge pull request #5781 from nextcloud/techdebt/noid/slow-participant-update-when-not-visible
Slow down the participant list update when not visible
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/RightSidebar/Participants/ParticipantsTab.vue | 24 | ||||
-rw-r--r-- | src/components/RightSidebar/RightSidebar.vue | 1 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/components/RightSidebar/Participants/ParticipantsTab.vue b/src/components/RightSidebar/Participants/ParticipantsTab.vue index 18fb8626d..dea5e909b 100644 --- a/src/components/RightSidebar/Participants/ParticipantsTab.vue +++ b/src/components/RightSidebar/Participants/ParticipantsTab.vue @@ -86,6 +86,10 @@ export default { type: Boolean, required: true, }, + isActive: { + type: Boolean, + required: true, + }, }, data() { @@ -183,11 +187,27 @@ export default { } }, 250), - debounceUpdateParticipants: debounce(function() { + debounceUpdateParticipants() { + if (!this.$store.getters.windowIsVisible() + || !this.$store.getters.getSidebarStatus + || !this.isActive) { + this.debounceSlowUpdateParticipants() + } + + this.debounceFastUpdateParticipants() + }, + + debounceSlowUpdateParticipants: debounce(function() { + if (!this.fetchingParticipants) { + this.cancelableGetParticipants() + } + }, 15000), + + debounceFastUpdateParticipants: debounce(function() { if (!this.fetchingParticipants) { this.cancelableGetParticipants() } - }, 2000), + }, 3000), async fetchSearchResults() { try { diff --git a/src/components/RightSidebar/RightSidebar.vue b/src/components/RightSidebar/RightSidebar.vue index 2313beac1..acf8579b6 100644 --- a/src/components/RightSidebar/RightSidebar.vue +++ b/src/components/RightSidebar/RightSidebar.vue @@ -52,6 +52,7 @@ :name="t('spreed', 'Participants')" icon="icon-contacts-dark"> <ParticipantsTab + :is-active="activeTab === 'participants'" :can-search="canSearchParticipants" :can-add="canAddParticipants" /> </AppSidebarTab> |