wait with updates until we have at least the news

This commit is contained in:
Christian Landgren 2020-12-27 11:59:53 +01:00
parent a81ddf3d01
commit e76bced86b
1 changed files with 1 additions and 2 deletions

View File

@ -36,11 +36,10 @@ export const Children = ({ navigation }) => {
console.log('no children found', await api.getChildren())
return navigation.navigate('Login', { error: 'Hittar inga barn för det personnumret' })
}
await setChildren(childrenList)
childrenList.forEach(async (child, i) => {
let result
let updatedChild
let updatedChild // keep a reference to the latest updated information so we don't patch an old object
const iter = fillChild(child)
while (!result?.done) {
result = await iter.next() // get updated values for every updated property