From c10e410573b636528420ac21b88643bdcfe2ef71 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Fri, 15 Mar 2024 21:21:04 +0900
Subject: [PATCH] Fix filter method for Firefish
---
renderer/components/timelines/Timeline.tsx | 33 +++++++++++++---------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/renderer/components/timelines/Timeline.tsx b/renderer/components/timelines/Timeline.tsx
index 311346c2..4f23c6b4 100644
--- a/renderer/components/timelines/Timeline.tsx
+++ b/renderer/components/timelines/Timeline.tsx
@@ -112,21 +112,26 @@ export default function Timeline(props: Props) {
}, [props.timeline, props.client, props.account])
const loadFilter = async (tl: string, client: MegalodonInterface): Promise> => {
- const res = await client.getFilters()
- let context = 'home'
- switch (tl) {
- case 'home':
- context = 'home'
- break
- case 'local':
- case 'public':
- context = 'public'
- break
- default:
- context = 'home'
- break
+ try {
+ const res = await client.getFilters()
+ let context = 'home'
+ switch (tl) {
+ case 'home':
+ context = 'home'
+ break
+ case 'local':
+ case 'public':
+ context = 'public'
+ break
+ default:
+ context = 'home'
+ break
+ }
+ return res.data.filter(f => f.context.includes(context))
+ } catch (e) {
+ console.error(e)
+ return []
}
- return res.data.filter(f => f.context.includes(context))
}
const loadTimeline = async (tl: string, client: MegalodonInterface, maxId?: string): Promise> => {