fix bug of nonupdating level title

This commit is contained in:
Alexander Bentkamp
2022-12-21 15:16:38 +01:00
parent 2f0af5f472
commit 53bed75036
+6 -2
View File
@@ -141,8 +141,12 @@ function Level() {
}, [worldId])
useEffect(() => {
setSubtitle(`Level ${levelId}: ${level?.data?.title}`)
}, [level?.data?.title])
if (level?.data?.title) {
setSubtitle(`Level ${levelId}: ${level?.data?.title}`)
} else {
setSubtitle(`Level ${levelId}`)
}
}, [levelId, level?.data?.title])
return <>
<Box style={level.isLoading ? null : {display: "none"}} display="flex" alignItems="center" justifyContent="center" sx={{ height: "calc(100vh - 64px)" }}><CircularProgress /></Box>