mirror of
https://github.com/apache/superset.git
synced 2026-05-06 16:34:32 +00:00
fix(native filters): throws an error when a chart containing a bigint value (#34539)
This commit is contained in:
@@ -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),
|
||||
]);
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user