Merge pull request #32391 from sonikro/master

fix(useEntityListProvider): solves bug related to qs library upgrade breaking when more than 20 values in the same query parameter key
This commit is contained in:
Fredrik Adelöw
2026-01-21 13:56:57 +01:00
committed by GitHub
3 changed files with 28 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-react': patch
---
Fixes a bug where the `EntityListProvider` would not correctly hydrate query parameters if more than 20 were provided for the same key.
@@ -222,6 +222,27 @@ describe('<EntityListProvider />', () => {
});
});
it('resolves query param filter values with large arrays', async () => {
const largeArray = Array.from({ length: 50 }, (_, i) => `owner-${i}`);
const query = qs.stringify({
filters: { kind: 'component', owners: largeArray },
});
const { result } = renderHook(() => useEntityList(), {
wrapper: createWrapper({
location: `/catalog?${query}`,
pagination,
}),
});
await waitFor(() => {
expect(result.current.queryParameters).toBeTruthy();
});
expect(result.current.queryParameters).toEqual({
kind: 'component',
owners: largeArray,
});
});
it('does not fetch when only frontend filters change', async () => {
const { result } = renderHook(() => useEntityList(), {
wrapper: createWrapper({ pagination }),
@@ -199,6 +199,7 @@ export const EntityListProvider = <EntityFilters extends DefaultEntityFilters>(
} = useMemo(() => {
const parsed = qs.parse(location.search, {
ignoreQueryPrefix: true,
arrayLimit: 10000,
});
let limit = paginationLimit;
@@ -398,6 +399,7 @@ export const EntityListProvider = <EntityFilters extends DefaultEntityFilters>(
const oldParams = qs.parse(location.search, {
ignoreQueryPrefix: true,
arrayLimit: 10000,
});
const newParams = qs.stringify(
{