Skip to content

Commit

Permalink
Pass layers as state to reconcile
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbyul-here committed Jun 25, 2024
1 parent 9472599 commit 3cfd052
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/scripts/components/common/blocks/block-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ function MapBlock(props: MapBlockProps) {
return totalLayers;
},[layerId]);

const [layers, setLayers] = useState<VizDataset[] | undefined>(layersToFetch);
const [layers, setLayers] = useState<VizDataset[]>(layersToFetch);

useReconcileWithStacMetadata(layersToFetch, setLayers);
useReconcileWithStacMetadata(layers, setLayers);

const selectedDatetime: (Date | undefined) = dateTime
? utcString2userTzDate(dateTime)
Expand Down Expand Up @@ -295,7 +295,7 @@ function MapBlock(props: MapBlockProps) {
}}
>
<Basemap basemapStyleId={mapBasemapId} />
{selectedDatetime && layerId && baseDataLayer && (
{selectedDatetime && baseDataLayer && (
<Layer
key={baseDataLayer.data.id}
id={`base-${baseDataLayer.data.id}`}
Expand Down Expand Up @@ -352,8 +352,7 @@ function MapBlock(props: MapBlockProps) {
{selectedCompareDatetime && (
<Compare>
<Basemap basemapStyleId={mapBasemapId} />
{layerId &&
compareDataLayer && (
{compareDataLayer && (
<Layer
key={compareDataLayer.data.id}
id={`compare-${compareDataLayer.data.id}`}
Expand Down

0 comments on commit 3cfd052

Please sign in to comment.