From b1a75177a0165f726741219206bb52c02c5f6221 Mon Sep 17 00:00:00 2001 From: tamaina Date: Thu, 5 Jan 2023 03:28:25 +0900 Subject: [PATCH] =?UTF-8?q?enhance:=20RSS=E3=82=A6=E3=82=A3=E3=82=B8?= =?UTF-8?q?=E3=82=A7=E3=83=83=E3=83=88=20/=20RSS=E3=83=86=E3=82=A3?= =?UTF-8?q?=E3=83=83=E3=82=AB=E3=83=BC=E3=82=A6=E3=82=A3=E3=82=B8=E3=82=A7?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=82=92=E3=81=84=E3=81=84=E6=84=9F=E3=81=98?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B=20(#9469)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :v: * use useInterval * :v: * rawItems.value.length !== 0 * fix * https://github.com/misskey-dev/misskey/pull/9469#discussion_r1061763613 --- packages/frontend/src/scripts/use-interval.ts | 11 +- packages/frontend/src/widgets/rss-ticker.vue | 157 +++++++++++------- packages/frontend/src/widgets/rss.vue | 88 ++++++---- 3 files changed, 159 insertions(+), 97 deletions(-) diff --git a/packages/frontend/src/scripts/use-interval.ts b/packages/frontend/src/scripts/use-interval.ts index 201ba417ef..601dea6724 100644 --- a/packages/frontend/src/scripts/use-interval.ts +++ b/packages/frontend/src/scripts/use-interval.ts @@ -3,7 +3,7 @@ import { onMounted, onUnmounted } from 'vue'; export function useInterval(fn: () => void, interval: number, options: { immediate: boolean; afterMounted: boolean; -}): void { +}): (() => void) | undefined { if (Number.isNaN(interval)) return; let intervalId: number | null = null; @@ -18,7 +18,14 @@ export function useInterval(fn: () => void, interval: number, options: { intervalId = window.setInterval(fn, interval); } - onUnmounted(() => { + const clear = () => { if (intervalId) window.clearInterval(intervalId); + intervalId = null; + }; + + onUnmounted(() => { + clear(); }); + + return clear; } diff --git a/packages/frontend/src/widgets/rss-ticker.vue b/packages/frontend/src/widgets/rss-ticker.vue index c2d6dd2873..37672e13cf 100644 --- a/packages/frontend/src/widgets/rss-ticker.vue +++ b/packages/frontend/src/widgets/rss-ticker.vue @@ -3,13 +3,15 @@ -
- -
- +
+
+ +
+
+ - - {{ item.title }} + + {{ item.title }} @@ -19,14 +21,14 @@ - diff --git a/packages/frontend/src/widgets/rss.vue b/packages/frontend/src/widgets/rss.vue index c0338c8e47..554413cd1e 100644 --- a/packages/frontend/src/widgets/rss.vue +++ b/packages/frontend/src/widgets/rss.vue @@ -5,19 +5,24 @@
-
- {{ item.title }} +
+ +
{{ i18n.ts.nothing }}
+
+
-