Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-06-16 09:55:52 +0300
committerJoas Schilling <coding@schilljs.com>2021-06-16 09:55:52 +0300
commit10e241082b106915fe26696dd2cd809a9992cf26 (patch)
tree7027955260ee8a384ee5f3c58704cb1f02de3bab
parentbd4787dfd158a6e34023cb8809f99c7b3cccbfb1 (diff)
Slow down the participant list update when not visible
There is not a lot use in updating the participant list every 2 seconds, when the list is not display, the sidebar closed or even the window hidden. Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--src/components/RightSidebar/Participants/ParticipantsTab.vue24
-rw-r--r--src/components/RightSidebar/RightSidebar.vue1
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>