diff --git a/package.json b/package.json index d46c919..c4577df 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@hisptz/react-ui", "homepage": "https://hisptz.github.io/react-ui", - "version": "1.0.85", + "version": "1.0.86", "description": "A collection of reusable complex DHIS2 react ui components.", "license": "BSD-3-Clause", "scripts": { diff --git a/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx b/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx index 67820fa..0fd9466 100644 --- a/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx +++ b/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx @@ -135,11 +135,19 @@ export function useThematicLayers(): any { scale: defaultClasses, colorClass: defaultColorScaleName, }; - const sortedData = sortBy(layer.data, "data"); + const sortedData = sortBy( + layer.data.filter((datum) => !!datum.data), + "data" + ); const autoLegends = generateLegends(last(sortedData)?.data ?? 0, head(sortedData)?.data ?? 0, { classesCount: scale, colorClass, }); + console.log({ + scale, + colorClass, + sortedData, + }); legends.push(...autoLegends); } return { diff --git a/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx b/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx index aa54c52..845d11c 100644 --- a/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx +++ b/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx @@ -43,6 +43,9 @@ export function MapLayersProvider({ layers, children }: { layers: MapLayerConfig const sanitizedBoundaryLayers = (boundaryLayers ?? []) as CustomBoundaryLayer[]; const sanitizedPointLayer = head(pointLayers ?? []) ? await sanitizePointLayer(head(pointLayers) as CustomPointLayer) : undefined; const sanitizedEarthEngineLayers = await sanitizeEarthEngineLayers([...(earthEngineLayers ?? [])] as unknown as CustomGoogleEngineLayer[]); + + console.log(sanitizedThematicLayers); + setUpdatedLayers( compact([...(sanitizedBoundaryLayers ?? []), ...(sanitizedThematicLayers ?? []), sanitizedPointLayer, ...(sanitizedEarthEngineLayers ?? [])]) );