From 9ee859571fffa2ce6a9e443a22b25c41881ec3ba Mon Sep 17 00:00:00 2001 From: Max Burri Date: Thu, 9 Jul 2026 09:32:15 +0000 Subject: [PATCH 1/3] fix: first draft --- app/charts/shared/chart-helpers.tsx | 2 +- app/config-types.ts | 2 +- .../configurator-state/reducer.tsx | 6 +++- app/utils/chart-config/constants.ts | 4 +-- app/utils/chart-config/versioning.ts | 34 +++++++++++++++++++ 5 files changed, 43 insertions(+), 5 deletions(-) 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..7d720e79c 100644 --- a/app/config-types.ts +++ b/app/config-types.ts @@ -951,7 +951,7 @@ export type MapAreaLayer = t.TypeOf; const MapSymbolLayer = t.type({ componentId: t.string, /** Symbol radius (size) */ - measureId: t.string, + measureId: t.union([t.string, t.undefined]), // FIXME: convert to new color field type color: t.union([FixedColorField, CategoricalColorField, NumericalColorField]), }); diff --git a/app/configurator/configurator-state/reducer.tsx b/app/configurator/configurator-state/reducer.tsx index d69893015..55ddce466 100644 --- a/app/configurator/configurator-state/reducer.tsx +++ b/app/configurator/configurator-state/reducer.tsx @@ -522,7 +522,11 @@ export const handleChartFieldUpdated = ( } if (value === FIELD_VALUE_NONE) { - unset(chartConfig, updatePath); + if (field === "symbolLayer" && path === "measureId") { + setWith(chartConfig, updatePath, FIELD_VALUE_NONE, Object); + } else { + unset(chartConfig, updatePath); + } } else { setWith(chartConfig, updatePath, value, Object); } diff --git a/app/utils/chart-config/constants.ts b/app/utils/chart-config/constants.ts index 18f3eb76f..0f9d5d189 100644 --- a/app/utils/chart-config/constants.ts +++ b/app/utils/chart-config/constants.ts @@ -1,3 +1,3 @@ -export const CONFIGURATOR_STATE_VERSION = "5.3.0"; +export const CONFIGURATOR_STATE_VERSION = "5.4.0"; -export const CHART_CONFIG_VERSION = "5.3.0"; +export const CHART_CONFIG_VERSION = "5.4.0"; diff --git a/app/utils/chart-config/versioning.ts b/app/utils/chart-config/versioning.ts index 13b440627..68134b48c 100644 --- a/app/utils/chart-config/versioning.ts +++ b/app/utils/chart-config/versioning.ts @@ -1749,6 +1749,34 @@ export const chartConfigMigrations: Migration[] = [ return newConfig; }, }, + { + description: `MAP + symbolLayer { + + measureId (if missing) + }`, + from: "5.3.0", + to: "5.4.0", + up: (config) => { + const newConfig = { ...config, version: "5.4.0" }; + + if ( + newConfig.chartType === "map" && + newConfig.fields.symbolLayer && + newConfig.fields.symbolLayer.measureId === undefined + ) { + newConfig.fields.symbolLayer = { + ...newConfig.fields.symbolLayer, + measureId: FIELD_VALUE_NONE, + }; + } + + return newConfig; + }, + down: (config) => { + const newConfig = { ...config, version: "5.3.0" }; + return newConfig; + }, + }, ]; export const migrateChartConfig = makeMigrate( @@ -2398,6 +2426,12 @@ export const configuratorStateMigrations: Migration[] = [ fromChartConfigVersion: "5.2.0", toChartConfigVersion: "5.3.0", }), + makeBumpChartConfigVersionMigration({ + fromVersion: "5.3.0", + toVersion: "5.4.0", + fromChartConfigVersion: "5.3.0", + toChartConfigVersion: "5.4.0", + }), ]; export const migrateConfiguratorState = makeMigrate( From cff8cc6daeb3ce0b82e7d76bccefbadb4ac420ba Mon Sep 17 00:00:00 2001 From: Max Burri Date: Thu, 9 Jul 2026 09:40:45 +0000 Subject: [PATCH 2/3] fix: make measure id truly optional - no need for new chart config version --- app/charts/index.ts | 3 +- app/config-types.ts | 22 ++++++++---- .../configurator-state/reducer.tsx | 6 +--- app/utils/chart-config/constants.ts | 4 +-- app/utils/chart-config/versioning.ts | 34 ------------------- 5 files changed, 19 insertions(+), 50 deletions(-) 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/config-types.ts b/app/config-types.ts index 7d720e79c..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.union([t.string, t.undefined]), - // 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({ diff --git a/app/configurator/configurator-state/reducer.tsx b/app/configurator/configurator-state/reducer.tsx index 55ddce466..d69893015 100644 --- a/app/configurator/configurator-state/reducer.tsx +++ b/app/configurator/configurator-state/reducer.tsx @@ -522,11 +522,7 @@ export const handleChartFieldUpdated = ( } if (value === FIELD_VALUE_NONE) { - if (field === "symbolLayer" && path === "measureId") { - setWith(chartConfig, updatePath, FIELD_VALUE_NONE, Object); - } else { - unset(chartConfig, updatePath); - } + unset(chartConfig, updatePath); } else { setWith(chartConfig, updatePath, value, Object); } diff --git a/app/utils/chart-config/constants.ts b/app/utils/chart-config/constants.ts index 0f9d5d189..18f3eb76f 100644 --- a/app/utils/chart-config/constants.ts +++ b/app/utils/chart-config/constants.ts @@ -1,3 +1,3 @@ -export const CONFIGURATOR_STATE_VERSION = "5.4.0"; +export const CONFIGURATOR_STATE_VERSION = "5.3.0"; -export const CHART_CONFIG_VERSION = "5.4.0"; +export const CHART_CONFIG_VERSION = "5.3.0"; diff --git a/app/utils/chart-config/versioning.ts b/app/utils/chart-config/versioning.ts index 68134b48c..13b440627 100644 --- a/app/utils/chart-config/versioning.ts +++ b/app/utils/chart-config/versioning.ts @@ -1749,34 +1749,6 @@ export const chartConfigMigrations: Migration[] = [ return newConfig; }, }, - { - description: `MAP - symbolLayer { - + measureId (if missing) - }`, - from: "5.3.0", - to: "5.4.0", - up: (config) => { - const newConfig = { ...config, version: "5.4.0" }; - - if ( - newConfig.chartType === "map" && - newConfig.fields.symbolLayer && - newConfig.fields.symbolLayer.measureId === undefined - ) { - newConfig.fields.symbolLayer = { - ...newConfig.fields.symbolLayer, - measureId: FIELD_VALUE_NONE, - }; - } - - return newConfig; - }, - down: (config) => { - const newConfig = { ...config, version: "5.3.0" }; - return newConfig; - }, - }, ]; export const migrateChartConfig = makeMigrate( @@ -2426,12 +2398,6 @@ export const configuratorStateMigrations: Migration[] = [ fromChartConfigVersion: "5.2.0", toChartConfigVersion: "5.3.0", }), - makeBumpChartConfigVersionMigration({ - fromVersion: "5.3.0", - toVersion: "5.4.0", - fromChartConfigVersion: "5.3.0", - toChartConfigVersion: "5.4.0", - }), ]; export const migrateConfiguratorState = makeMigrate( From 65a0ec6ca6c2a99f89e18360df64dc6460ddb5ad Mon Sep 17 00:00:00 2001 From: Max Burri Date: Thu, 9 Jul 2026 11:29:32 +0000 Subject: [PATCH 3/3] doc: add changelog entry --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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