Skip to content

Commit 32c4962

Browse files
committed
fix: Do not assure that components iris are defined
...as they will be undefined for some chart types.
1 parent 4363e67 commit 32c4962

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

app/charts/shared/chart-data-filters.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,12 @@ export const useChartDataFiltersState = ({
7272
}) => {
7373
const componentIris =
7474
chartConfig.interactiveFiltersConfig?.dataFilters.componentIris;
75-
assert(componentIris, "Data filters are not enabled for this chart.");
7675
const [open, setOpen] = useState(false);
7776
useEffect(() => {
78-
if (componentIris.length === 0) {
77+
if (componentIris?.length === 0) {
7978
setOpen(false);
8079
}
81-
}, [componentIris.length]);
80+
}, [componentIris?.length]);
8281
const { loading } = useLoadingState();
8382
const queryFilters = useQueryFilters({
8483
chartConfig,
@@ -98,7 +97,7 @@ export const useChartDataFiltersState = ({
9897
cubeQueryFilters.filters as Filters
9998
).filter(([k]) => unmappedKeys.includes(k));
10099
const interactiveFiltersList = unmappedEntries.filter(([k]) =>
101-
componentIris.includes(k)
100+
componentIris?.includes(k)
102101
);
103102
return {
104103
cubeIri: cube.iri,
@@ -145,7 +144,7 @@ export const ChartDataFiltersToggle = (
145144
minHeight: 20,
146145
}}
147146
>
148-
{componentIris.length > 0 && (
147+
{componentIris && componentIris.length > 0 && (
149148
<Button
150149
variant="text"
151150
color="primary"
@@ -202,7 +201,7 @@ export const ChartDataFiltersList = (
202201
componentIris,
203202
} = props;
204203
const dataFilters = useChartInteractiveFilters((d) => d.dataFilters);
205-
return componentIris.length > 0 ? (
204+
return componentIris && componentIris.length > 0 ? (
206205
<Box
207206
data-testid="published-chart-interactive-filters"
208207
sx={{

0 commit comments

Comments
 (0)