@geo2france/api-dashboard 1.10.0 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,7 +64,7 @@ export const MapLayer = ({ dataset, categoryKey, color = 'red', type = 'circle',
64
64
  : data?.geojson; // Sinon on utilise le geojson (fournisseur wfs)
65
65
  const geom_type = geojson?.features?.[0] && getType(geojson?.features?.[0]);
66
66
  /** Type de données dans categoryKey (string ou number) */
67
- const type_value = categoryKey && typeof (data?.data?.[0][categoryKey]);
67
+ const type_value = categoryKey && typeof (data?.data?.[0]?.[categoryKey]);
68
68
  /** Valeurs distinctes (si type string) */
69
69
  const values = (type_value === 'string') && categoryKey && data?.data && from(data?.data).rollup({ a: op.array_agg_distinct(categoryKey) }).get('a', 0) || undefined;
70
70
  /** Couleurs de la palette */
@@ -105,7 +105,7 @@ export const MapLayer = ({ dataset, categoryKey, color = 'red', type = 'circle',
105
105
  }
106
106
  //devnote : regarder la colonne contenant les valeurs pour proposer une représentation (catégorie ou choroplèthe)
107
107
  useEffect(() => {
108
- if (geojson) {
108
+ if (geojson && geojson.features.length > 0) { // do not fitbound if no features
109
109
  const box = bbox(geojson).slice(0, 4);
110
110
  map?.fitBounds(box, { padding: 20 });
111
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geo2france/api-dashboard",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "private": false,
5
5
  "description": "Build dashboards with JSX/TSX",
6
6
  "main": "dist/index.js",