fix(native filters): throws an error when a chart containing a bigint value (#34539)

This commit is contained in:
JUST.in DO IT
2025-08-04 12:17:06 -07:00
committed by GitHub
parent ccf6290120
commit 2f8939d229
2 changed files with 45 additions and 1 deletions

View File

@@ -676,7 +676,7 @@ const FiltersConfigForm = (
});
return excluded;
}, [
JSON.stringify(charts),
JSON.stringify(Object.values(charts).map(chart => chart.id)),
formFilter?.dataset?.value,
JSON.stringify(loadedDatasets),
]);

View File

@@ -76,6 +76,29 @@ const noTemporalColumnsState = () => {
};
};
const bigIntChartDataState = () => {
const state = defaultState();
return {
...state,
charts: {
...state.charts,
999: {
queriesResponse: [
{
status: 'success',
data: [
{ name: 'Abigail', count: 228 },
{ name: 'Aaron', count: 123012930123123n },
{ name: 'Adam', count: 454 },
],
applied_filters: [{ column: 'name' }],
},
],
},
},
};
};
const datasetResult = (id: number) => ({
description_columns: {},
id,
@@ -591,3 +614,24 @@ test('modifies the name of a filter', async () => {
),
);
});
test('renders a filter with a chart containing BigInt values', async () => {
const nativeFilterState = [
buildNativeFilter('NATIVE_FILTER-1', 'state', ['NATIVE_FILTER-2']),
buildNativeFilter('NATIVE_FILTER-2', 'country', []),
buildNativeFilter('NATIVE_FILTER-3', 'product', []),
];
const state = {
...bigIntChartDataState(),
dashboardInfo: {
metadata: { native_filter_configuration: nativeFilterState },
},
dashboardLayout,
};
defaultRender(state, {
...props,
createNewOnOpen: false,
});
expect(screen.getByText(FILTER_TYPE_REGEX)).toBeInTheDocument();
});