Merge branch 'fix/chart-warning' into 'main'

Fix useEffect callback cannot be async

See merge request bloodyhealth/drip!540
This commit is contained in:
Sofiya Tepikin
2022-09-20 15:32:47 +00:00
+15 -3
View File
@@ -31,9 +31,21 @@ const getSymptomsFromCycleDays = (cycleDays) =>
const CycleChart = ({ navigate, setDate }) => {
const [shouldShowHint, setShouldShowHint] = useState(true)
useEffect(async () => {
const flag = await getChartFlag()
setShouldShowHint(flag === 'true')
useEffect(() => {
let isMounted = true
async function checkShouldShowHint() {
const flag = await getChartFlag()
if (isMounted) {
setShouldShowHint(flag === 'true')
}
}
checkShouldShowHint()
return () => {
isMounted = false
}
}, [])
const hideHint = () => {