From d0d32e88466cef53a0d4429cce1ce4b9cb97d5b1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 2 Nov 2023 18:07:42 +0900 Subject: [PATCH] enhance(frontend): improve pull to refresh --- .../src/components/MkNotifications.vue | 51 ++++++++++++------- .../src/components/MkPullToRefresh.vue | 16 ++++-- .../frontend/src/components/MkTimeline.vue | 25 ++++----- 3 files changed, 56 insertions(+), 36 deletions(-) diff --git a/packages/frontend/src/components/MkNotifications.vue b/packages/frontend/src/components/MkNotifications.vue index 8d99e440e1..77e66f0165 100644 --- a/packages/frontend/src/components/MkNotifications.vue +++ b/packages/frontend/src/components/MkNotifications.vue @@ -4,25 +4,27 @@ SPDX-License-Identifier: AGPL-3.0-only --> diff --git a/packages/frontend/src/components/MkTimeline.vue b/packages/frontend/src/components/MkTimeline.vue index a2ada35f91..845c7a414c 100644 --- a/packages/frontend/src/components/MkTimeline.vue +++ b/packages/frontend/src/components/MkTimeline.vue @@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only --> @@ -196,25 +196,18 @@ const pagination = { params: query, }; -const reloadTimeline = (fromPR = false) => { - tlNotesCount = 0; +function reloadTimeline() { + return new Promise((res) => { + tlNotesCount = 0; - tlComponent.pagingComponent?.reload().then(() => { - reloadStream(); - if (fromPR) prComponent.refreshFinished(); + tlComponent.pagingComponent?.reload().then(() => { + reloadStream(); + res(); + }); }); -}; - -//const pullRefresh = () => reloadTimeline(true); +} defineExpose({ reloadTimeline, }); - -/* TODO -const timetravel = (date?: Date) => { - this.date = date; - this.$refs.tl.reload(); -}; -*/