Fix some useEffect() cleanup issues
This commit is contained in:
parent
1983512fef
commit
1ab8285ad3
6 changed files with 38 additions and 2 deletions
|
@ -214,21 +214,27 @@ const CreateAccount = ({onPressBack}: {onPressBack: () => void}) => {
|
|||
const [username, setUsername] = useState<string>('')
|
||||
|
||||
useEffect(() => {
|
||||
let aborted = false
|
||||
if (serviceDescription || error) {
|
||||
return
|
||||
}
|
||||
store.session.describeService('http://localhost:2583/').then(
|
||||
desc => {
|
||||
if (aborted) return
|
||||
setServiceDescription(desc)
|
||||
setUserDomain(desc.availableUserDomains[0])
|
||||
},
|
||||
err => {
|
||||
if (aborted) return
|
||||
console.error(err)
|
||||
setError(
|
||||
'Unable to contact your service. Please check your Internet connection.',
|
||||
)
|
||||
},
|
||||
)
|
||||
return () => {
|
||||
aborted = true
|
||||
}
|
||||
}, [])
|
||||
|
||||
const onPressNext = async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue