defer loading of feeds until visible (#1271)
* defer loading of feeds until visible * Fix: use existing hasLoaded * Fix: dont query for latest during initial load --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>
This commit is contained in:
parent
a5981e127f
commit
4654a9a45e
3 changed files with 40 additions and 37 deletions
|
@ -56,7 +56,6 @@ export const HomeScreen = withAuthRequired(
|
|||
const feeds = []
|
||||
for (const feed of pinned) {
|
||||
const model = new PostsFeedModel(store, 'custom', {feed: feed.uri})
|
||||
model.setup()
|
||||
feeds.push(model)
|
||||
}
|
||||
pagerRef.current?.setPage(0)
|
||||
|
@ -169,6 +168,13 @@ const FeedPage = observer(
|
|||
})
|
||||
const isScreenFocused = useIsFocused()
|
||||
|
||||
React.useEffect(() => {
|
||||
// called on first load
|
||||
if (!feed.hasLoaded && isPageFocused) {
|
||||
feed.setup()
|
||||
}
|
||||
}, [isPageFocused, feed])
|
||||
|
||||
const doPoll = React.useCallback(
|
||||
(knownActive = false) => {
|
||||
if (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue