Skip to content

Commit

Permalink
fix: Deriving of timeRange interactive filter when changing chart type
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Jun 13, 2023
1 parent e56d012 commit 9429c32
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/charts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ const interactiveFiltersAdjusters: InteractiveFiltersAdjusters = {

return newChartConfig;
},
time: {
timeRange: {
active: ({ oldValue, newChartConfig }) => {
return produce(newChartConfig, (draft) => {
if (draft.interactiveFiltersConfig) {
Expand Down
13 changes: 11 additions & 2 deletions app/configurator/config-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,18 @@ export type FieldAdjuster<
measures: DataCubeMetadata["measures"];
}) => NewChartConfigType;

export type InteractiveFiltersAdjusters = {
type AssureKeys<T, U extends { [K in keyof T]: unknown }> = {
[K in keyof T]: U[K];
};

export type InteractiveFiltersAdjusters = AssureKeys<
InteractiveFiltersConfig,
_InteractiveFiltersAdjusters
>;

type _InteractiveFiltersAdjusters = {
legend: FieldAdjuster<ChartConfig, InteractiveFiltersLegend>;
time: {
timeRange: {
active: FieldAdjuster<ChartConfig, boolean>;
componentIri: FieldAdjuster<ChartConfig, string>;
presets: {
Expand Down

0 comments on commit 9429c32

Please sign in to comment.