Skip to content

Commit 0106430

Browse files
committed
Adjust default window and fix date reset
1 parent 246fc24 commit 0106430

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

demo/app/src/components/Map/Map.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ const Map = (props) => {
4545
const { userParams, setUserParams } = useAppContext();
4646
const { url, attribution } = whichMap('Stadia.AlidadeSmooth');
4747
const markerRef = useRef(null);
48+
const userParamsRef = useRef();
49+
50+
useEffect(()=>{
51+
userParamsRef.current = userParams;
52+
}, [userParams]);
4853

4954
useEffect(() => {
5055
if(!userParams.geometry && markerRef.current){
@@ -65,7 +70,7 @@ const Map = (props) => {
6570
*/
6671
function onCreated(e) {
6772
markerRef.current = e.layer;
68-
setUserParams({...userParams, geometry: {
73+
setUserParams({...userParamsRef.current, geometry: {
6974
"type": "Point",
7075
"coordinates": [e.layer._latlng.lng, e.layer._latlng.lat]
7176
}

demo/app/src/context/appContext.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const today = new Date();
99
const defaultUserParams = {
1010
dateRange: [
1111
today,
12-
new Date(new Date(today).setDate(today.getDate() + 3)),
12+
new Date(new Date(today).setDate(today.getDate() + 14)),
1313
],
1414
provider: 'all',
1515
product: 'all'

0 commit comments

Comments
 (0)