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 CycleChart = ({ navigate, setDate }) => {
const [shouldShowHint, setShouldShowHint] = useState(true) const [shouldShowHint, setShouldShowHint] = useState(true)
useEffect(async () => { useEffect(() => {
const flag = await getChartFlag() let isMounted = true
setShouldShowHint(flag === 'true')
async function checkShouldShowHint() {
const flag = await getChartFlag()
if (isMounted) {
setShouldShowHint(flag === 'true')
}
}
checkShouldShowHint()
return () => {
isMounted = false
}
}, []) }, [])
const hideHint = () => { const hideHint = () => {