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 lintzio/stable
parent
bfed96bd7b
commit
aa4b79e77a
|
@ -36,13 +36,17 @@ export const HomeScreen = withAuthRequired(
|
|||
const pagerRef = React.useRef<PagerRef>(null)
|
||||
const [selectedPage, setSelectedPage] = React.useState(0)
|
||||
const [customFeeds, setCustomFeeds] = React.useState<PostsFeedModel[]>([])
|
||||
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(
|
||||
|
|
Loading…
Reference in New Issue