Skip to content

Commit

Permalink
Deregister timeout in ComparisonInput
Browse files Browse the repository at this point in the history
  • Loading branch information
apata committed Jul 23, 2024
1 parent 1fe437f commit 3d9f859
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion assets/js/dashboard/comparison-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ const ComparisonInput = function ({ navigate }) {
const [uiMode, setUiMode] = useState("menu")

useEffect(() => {
let timeout = null;
if (uiMode == "datepicker") {
setTimeout(() => calendar.current.flatpickr.open(), 100)
timeout = setTimeout(() => calendar.current?.flatpickr.open(), 100)
}
return () => timeout && clearTimeout(timeout)
}, [uiMode])

if (COMPARISON_DISABLED_PERIODS.includes(query.period)) return null
Expand Down

0 comments on commit 3d9f859

Please sign in to comment.