diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fc60a5a4..dc377fc64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,13 +12,16 @@ You can also check the ## Unreleased - Fixes + - Correctly set CSP headers for index pages - Harden markdown renderer sanitization + - Make measure id optional for symbol layers in map charts. Fixes issues with + invalid view configuration that prevents that users could copy and edit an + existing visualization - Maintenance - Add dev-container support - ## 6.5.0 – 2026-06-01 - Features diff --git a/app/charts/index.ts b/app/charts/index.ts index 7083238cc..a66b13997 100644 --- a/app/charts/index.ts +++ b/app/charts/index.ts @@ -59,7 +59,6 @@ import { TableFields, } from "@/config-types"; import { mapValueIrisToColor } from "@/configurator/components/ui-helpers"; -import { FIELD_VALUE_NONE } from "@/configurator/constants"; import { Component, Dimension, @@ -321,7 +320,7 @@ const getInitialSymbolLayer = ({ }): MapSymbolLayer => { return { componentId: component.id, - measureId: measure?.id ?? FIELD_VALUE_NONE, + measureId: measure?.id, color: DEFAULT_FIXED_COLOR_FIELD, }; }; diff --git a/app/charts/shared/chart-helpers.tsx b/app/charts/shared/chart-helpers.tsx index ec707cd90..2cae765c4 100644 --- a/app/charts/shared/chart-helpers.tsx +++ b/app/charts/shared/chart-helpers.tsx @@ -225,7 +225,7 @@ const getMapChartConfigAdditionalFieldIds = ({ fields }: MapConfig) => { } if (symbolLayer) { - if (symbolLayer.measureId !== FIELD_VALUE_NONE) { + if (symbolLayer.measureId && symbolLayer.measureId !== FIELD_VALUE_NONE) { additionalFields.push(symbolLayer.measureId); } diff --git a/app/config-types.ts b/app/config-types.ts index 4674a386b..6a30063c0 100644 --- a/app/config-types.ts +++ b/app/config-types.ts @@ -948,13 +948,21 @@ const MapAreaLayer = t.type({ }); export type MapAreaLayer = t.TypeOf; -const MapSymbolLayer = t.type({ - componentId: t.string, - /** Symbol radius (size) */ - measureId: t.string, - // FIXME: convert to new color field type - color: t.union([FixedColorField, CategoricalColorField, NumericalColorField]), -}); +const MapSymbolLayer = t.intersection([ + t.type({ + componentId: t.string, + // FIXME: convert to new color field type + color: t.union([ + FixedColorField, + CategoricalColorField, + NumericalColorField, + ]), + }), + t.partial({ + /** Symbol radius (size) */ + measureId: t.string, + }), +]); export type MapSymbolLayer = t.TypeOf; const BaseCustomLayer = t.type({