From aa4b79e77a52f612c5d62538270a138c8aac88b6 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 17 Jul 2023 17:31:56 -0500 Subject: [PATCH] handle failed custom feeds on home screen (#1012) * handle failed custom feeds on home screen * remove unnecessary edit * make sure edits to pinned feeds are handled and reloaded * fix lint --- src/view/screens/Home.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx index 41459cfa..b633e0e1 100644 --- a/src/view/screens/Home.tsx +++ b/src/view/screens/Home.tsx @@ -36,13 +36,17 @@ export const HomeScreen = withAuthRequired( const pagerRef = React.useRef(null) const [selectedPage, setSelectedPage] = React.useState(0) const [customFeeds, setCustomFeeds] = React.useState([]) + const [requestedCustomFeeds, setRequestedCustomFeeds] = React.useState< + string[] + >([]) React.useEffect(() => { const {pinned} = store.me.savedFeeds + if ( isEqual( pinned.map(p => p.uri), - customFeeds.map(f => (f.params as GetCustomFeed.QueryParams).feed), + requestedCustomFeeds, ) ) { // no changes @@ -57,12 +61,15 @@ export const HomeScreen = withAuthRequired( } pagerRef.current?.setPage(0) setCustomFeeds(feeds) + setRequestedCustomFeeds(pinned.map(p => p.uri)) }, [ store, store.me.savedFeeds.pinned, customFeeds, setCustomFeeds, pagerRef, + requestedCustomFeeds, + setRequestedCustomFeeds, ]) useFocusEffect(