Fix some useEffect() cleanup issues
This commit is contained in:
parent
1983512fef
commit
1ab8285ad3
6 changed files with 38 additions and 2 deletions
|
@ -23,6 +23,7 @@ export const Profile = observer(({visible, params}: ScreenParams) => {
|
|||
>()
|
||||
|
||||
useEffect(() => {
|
||||
let aborted = false
|
||||
if (!visible) {
|
||||
return
|
||||
}
|
||||
|
@ -36,9 +37,13 @@ export const Profile = observer(({visible, params}: ScreenParams) => {
|
|||
const newProfileUiState = new ProfileUiModel(store, {user})
|
||||
setProfileUiState(newProfileUiState)
|
||||
newProfileUiState.setup().then(() => {
|
||||
if (aborted) return
|
||||
setHasSetup(true)
|
||||
})
|
||||
}
|
||||
return () => {
|
||||
aborted = true
|
||||
}
|
||||
}, [visible, params.name, store])
|
||||
|
||||
// events
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue