From 9429c3240de410395b6b8e8aa640cd1a78647181 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Tue, 13 Jun 2023 14:18:01 +0200 Subject: [PATCH] fix: Deriving of timeRange interactive filter when changing chart type --- app/charts/index.ts | 2 +- app/configurator/config-types.ts | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/charts/index.ts b/app/charts/index.ts index eb91e6139..a3d3969fd 100644 --- a/app/charts/index.ts +++ b/app/charts/index.ts @@ -526,7 +526,7 @@ const interactiveFiltersAdjusters: InteractiveFiltersAdjusters = { return newChartConfig; }, - time: { + timeRange: { active: ({ oldValue, newChartConfig }) => { return produce(newChartConfig, (draft) => { if (draft.interactiveFiltersConfig) { diff --git a/app/configurator/config-types.ts b/app/configurator/config-types.ts index e9383ca3c..3f5a87561 100644 --- a/app/configurator/config-types.ts +++ b/app/configurator/config-types.ts @@ -680,9 +680,18 @@ export type FieldAdjuster< measures: DataCubeMetadata["measures"]; }) => NewChartConfigType; -export type InteractiveFiltersAdjusters = { +type AssureKeys = { + [K in keyof T]: U[K]; +}; + +export type InteractiveFiltersAdjusters = AssureKeys< + InteractiveFiltersConfig, + _InteractiveFiltersAdjusters +>; + +type _InteractiveFiltersAdjusters = { legend: FieldAdjuster; - time: { + timeRange: { active: FieldAdjuster; componentIri: FieldAdjuster; presets: {