Skip to content

Commit ec0ef5f

Browse files
committed
fix: Dashboard shared filter can work on merged cubes
1 parent 374fa09 commit ec0ef5f

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

app/components/dashboard-interactive-filters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const DashboardTimeRangeSlider = ({
185185

186186
const mountedForSomeTime = useTimeout(500, mounted);
187187

188-
if (!filter || !timeRange || filter.type !== "timeRange") {
188+
if (!filter || !timeRange || filter.type !== "timeRange" || !filter.active) {
189189
return null;
190190
}
191191

app/configurator/components/layout-configurator.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import {
4141
import {
4242
Dimension,
4343
TemporalDimension,
44+
isJoinByComponent,
4445
isTemporalDimension,
4546
} from "@/domain/data";
4647
import { useTimeFormatLocale, useTimeFormatUnit } from "@/formatters";
@@ -129,7 +130,16 @@ const LayoutSharedFiltersConfigurator = () => {
129130
});
130131

131132
const dimensionsByIri = useMemo(() => {
132-
return keyBy(data.data?.dataCubesComponents.dimensions, (x) => x.iri);
133+
const res: Record<string, Dimension> = {};
134+
for (const dim of data.data?.dataCubesComponents.dimensions ?? []) {
135+
res[dim.iri] = dim;
136+
if (isJoinByComponent(dim)) {
137+
for (const o of dim.originalIris) {
138+
res[o.dimensionIri] = dim;
139+
}
140+
}
141+
}
142+
return res;
133143
}, [data.data?.dataCubesComponents.dimensions]);
134144

135145
const sharedFiltersByIri = useMemo(() => {

app/stores/interactive-filters.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
useConfiguratorState,
1313
} from "@/configurator";
1414
import { truthy } from "@/domain/types";
15+
import { getOriginalIris, isJoinById } from "@/graphql/join";
1516
import {
1617
createBoundUseStoreWithSelector,
1718
ExtractState,
@@ -177,7 +178,10 @@ export const getPotentialSharedFilters = (
177178
: undefined;
178179
if (field && "componentIri" in field) {
179180
return {
180-
componentIri: field.componentIri as string,
181+
/** Unjoined dimension */
182+
componentIri: isJoinById(field.componentIri as string)
183+
? getOriginalIris(field.componentIri, config)[0]
184+
: field.componentIri,
181185
chartKey: config.key,
182186
};
183187
}

0 commit comments

Comments
 (0)