From 65404b381904a2627d38a3c4a98ada602fa58b54 Mon Sep 17 00:00:00 2001 From: Joko Priyono Date: Wed, 12 Jun 2024 16:16:20 +0700 Subject: [PATCH] fix: handle if selected date was undefined while double click on a same date in the calendar --- demo/frontend/src/Components/Map/Map.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/demo/frontend/src/Components/Map/Map.tsx b/demo/frontend/src/Components/Map/Map.tsx index 8e2435767..494eca248 100644 --- a/demo/frontend/src/Components/Map/Map.tsx +++ b/demo/frontend/src/Components/Map/Map.tsx @@ -62,17 +62,22 @@ class Map extends PureComponent<{}, {visibleLayer: any, range: any, hour: any}> }; changeFilter = (filter: string, value: any) => { - this.setState(state => ({ - ...state, - [filter]: value - })); + if (filter !== undefined && value !== undefined) { + this.setState(state => ({ + ...state, + [filter]: value + })); + } }; getQueryParams = () => { const { range: { from, to }, hour } = this.state; const dateFrom = `${dateConverter(from)}.2017`; - const dateTo = `${dateConverter(to)}.2017`; + let dateTo = `${dateConverter(to)}.2017`; + if (to === undefined) { + dateTo = dateFrom; + } return encodeURI(`date_from=${dateFrom}&date_to=${dateTo}&hour=${hour}`); };