From 46a25548c41cc47c91cd52b00cd4e0793909cec8 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Thu, 30 Sep 2021 14:19:00 +0200 Subject: [PATCH] People: Disable loadMore() and refresh() while tab is inactive #22 --- frontend/src/pages/people/faces.vue | 10 ++++++++-- frontend/src/pages/people/subjects.vue | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/people/faces.vue b/frontend/src/pages/people/faces.vue index 222fd02bf..8f34c2e78 100644 --- a/frontend/src/pages/people/faces.vue +++ b/frontend/src/pages/people/faces.vue @@ -373,7 +373,9 @@ export default { this.lastId = ""; }, loadMore() { - if (this.scrollDisabled) return; + if (this.scrollDisabled || !this.active) { + return; + } this.scrollDisabled = true; this.listen = false; @@ -456,11 +458,15 @@ export default { return params; }, refresh() { - if (this.loading) return; + if (this.loading || !this.active) { + return; + } + this.loading = true; this.page = 0; this.dirty = true; this.scrollDisabled = false; + this.loadMore(); }, search() { diff --git a/frontend/src/pages/people/subjects.vue b/frontend/src/pages/people/subjects.vue index a0ddd8119..963213dfe 100644 --- a/frontend/src/pages/people/subjects.vue +++ b/frontend/src/pages/people/subjects.vue @@ -420,7 +420,9 @@ export default { this.lastId = ""; }, loadMore() { - if (this.scrollDisabled) return; + if (this.scrollDisabled || !this.active) { + return; + } this.scrollDisabled = true; this.listen = false; @@ -503,11 +505,15 @@ export default { return params; }, refresh() { - if (this.loading) return; + if (this.loading || !this.active) { + return; + } + this.loading = true; this.page = 0; this.dirty = true; this.scrollDisabled = false; + this.loadMore(); }, search() {