Merge branch 'fix/chart-warning' into 'main'
Fix useEffect callback cannot be async See merge request bloodyhealth/drip!540
This commit is contained in:
@@ -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 = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user