Skip to content

Commit

Permalink
Revert "Initialize the map with North America AoI"
Browse files Browse the repository at this point in the history
This reverts commit f9ae022.
  • Loading branch information
nerik committed Sep 27, 2023
1 parent 15a3227 commit 240017f
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions app/scripts/components/analysis/define/aoi-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React, {
useCallback,
useEffect,
useMemo,
useRef,
useState
} from 'react';
import styled from 'styled-components';
Expand Down Expand Up @@ -43,7 +42,6 @@ import {
import DropMenuItemButton from '$styles/drop-menu-item-button';
import { makeFeatureCollection } from '$components/common/aoi/utils';
import { variableGlsp } from '$styles/variable-utils';
import { useEffectPrevious } from '$utils/use-effect-previous';

const MapContainer = styled.div`
position: relative;
Expand Down Expand Up @@ -77,19 +75,6 @@ export default function AoiSelector({
}: AoiSelectorProps) {
const { drawing, featureCollection } = aoiDrawState;

// TODO revise this. This is not a great hack aimed at initializing the AoI with North America when
// no qs AoI is set. Ideally this would be set in use-analysis-params initialState.
const timeOutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
useEffect(() => {
if (!qsAoi) {
timeOutRef.current = setTimeout(() => {
setFeatureCollection(FeatureByRegionPreset['north-america']);
}, 100);
} else {
if (timeOutRef.current) clearTimeout(timeOutRef.current);
}
}, [qsAoi]);

// For the drawing tool, the features need an id.
const qsFc: FeatureCollection<Polygon> | null = useMemo(() => {
return qsAoi
Expand Down Expand Up @@ -188,7 +173,7 @@ export default function AoiSelector({
</ToolbarIconButton>
)}
>
<DropTitle>Select a region</DropTitle>
<DropTitle>Select a region (BETA)</DropTitle>
<DropMenu>
<li>
<DropMenuItemButton
Expand Down

0 comments on commit 240017f

Please sign in to comment.