Fix some useEffect() cleanup issues
This commit is contained in:
parent
1983512fef
commit
1ab8285ad3
6 changed files with 38 additions and 2 deletions
|
@ -24,6 +24,7 @@ export const Home = observer(function Home({
|
|||
)
|
||||
|
||||
useEffect(() => {
|
||||
let aborted = false
|
||||
if (!visible) {
|
||||
return
|
||||
}
|
||||
|
@ -33,7 +34,13 @@ export const Home = observer(function Home({
|
|||
} else {
|
||||
store.nav.setTitle('Home')
|
||||
console.log('Fetching home feed')
|
||||
defaultFeedView.setup().then(() => setHasSetup(true))
|
||||
defaultFeedView.setup().then(() => {
|
||||
if (aborted) return
|
||||
setHasSetup(true)
|
||||
})
|
||||
}
|
||||
return () => {
|
||||
aborted = true
|
||||
}
|
||||
}, [visible, store])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue