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 pagerRef = React.useRef<PagerRef>(null)
|
||||||
const [selectedPage, setSelectedPage] = React.useState(0)
|
const [selectedPage, setSelectedPage] = React.useState(0)
|
||||||
const [customFeeds, setCustomFeeds] = React.useState<PostsFeedModel[]>([])
|
const [customFeeds, setCustomFeeds] = React.useState<PostsFeedModel[]>([])
|
||||||
|
const [requestedCustomFeeds, setRequestedCustomFeeds] = React.useState<
|
||||||
|
string[]
|
||||||
|
>([])
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const {pinned} = store.me.savedFeeds
|
const {pinned} = store.me.savedFeeds
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isEqual(
|
isEqual(
|
||||||
pinned.map(p => p.uri),
|
pinned.map(p => p.uri),
|
||||||
customFeeds.map(f => (f.params as GetCustomFeed.QueryParams).feed),
|
requestedCustomFeeds,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
// no changes
|
// no changes
|
||||||
|
@ -57,12 +61,15 @@ export const HomeScreen = withAuthRequired(
|
||||||
}
|
}
|
||||||
pagerRef.current?.setPage(0)
|
pagerRef.current?.setPage(0)
|
||||||
setCustomFeeds(feeds)
|
setCustomFeeds(feeds)
|
||||||
|
setRequestedCustomFeeds(pinned.map(p => p.uri))
|
||||||
}, [
|
}, [
|
||||||
store,
|
store,
|
||||||
store.me.savedFeeds.pinned,
|
store.me.savedFeeds.pinned,
|
||||||
customFeeds,
|
customFeeds,
|
||||||
setCustomFeeds,
|
setCustomFeeds,
|
||||||
pagerRef,
|
pagerRef,
|
||||||
|
requestedCustomFeeds,
|
||||||
|
setRequestedCustomFeeds,
|
||||||
])
|
])
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
|
|
Loading…
Reference in New Issue