From f5239835631332387fcf0ca9fb9a47a3f02d3397 Mon Sep 17 00:00:00 2001 From: Jonathan Nagayoshi Date: Tue, 20 Jan 2026 19:59:51 +0000 Subject: [PATCH 1/2] fix(useEntityListProvider): sets arrayLimit to 10000 to solve problem parsing urls with more than 20 occurences of the same query parameter key Signed-off-by: Jonathan Nagayoshi --- .changeset/big-rabbits-think.md | 5 +++++ .../src/hooks/useEntityListProvider.test.tsx | 21 +++++++++++++++++++ .../src/hooks/useEntityListProvider.tsx | 2 ++ 3 files changed, 28 insertions(+) create mode 100644 .changeset/big-rabbits-think.md diff --git a/.changeset/big-rabbits-think.md b/.changeset/big-rabbits-think.md new file mode 100644 index 0000000000..9312a32bf3 --- /dev/null +++ b/.changeset/big-rabbits-think.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-react': patch +--- + +fixes bug related to qs library upgrade. makes the EntityListProvider return the correct queryParameters even when there are more than 20 occurences of the same value diff --git a/plugins/catalog-react/src/hooks/useEntityListProvider.test.tsx b/plugins/catalog-react/src/hooks/useEntityListProvider.test.tsx index 7b9d17d82e..711fb09f8c 100644 --- a/plugins/catalog-react/src/hooks/useEntityListProvider.test.tsx +++ b/plugins/catalog-react/src/hooks/useEntityListProvider.test.tsx @@ -222,6 +222,27 @@ describe('', () => { }); }); + 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 }), diff --git a/plugins/catalog-react/src/hooks/useEntityListProvider.tsx b/plugins/catalog-react/src/hooks/useEntityListProvider.tsx index a2ab4ea377..12eb9dff6c 100644 --- a/plugins/catalog-react/src/hooks/useEntityListProvider.tsx +++ b/plugins/catalog-react/src/hooks/useEntityListProvider.tsx @@ -199,6 +199,7 @@ export const EntityListProvider = ( } = useMemo(() => { const parsed = qs.parse(location.search, { ignoreQueryPrefix: true, + arrayLimit: 10000, }); let limit = paginationLimit; @@ -398,6 +399,7 @@ export const EntityListProvider = ( const oldParams = qs.parse(location.search, { ignoreQueryPrefix: true, + arrayLimit: 10000, }); const newParams = qs.stringify( { From 7e11dffe313976bfe287e86b5f32fa2e516e57a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 21 Jan 2026 13:44:06 +0100 Subject: [PATCH 2/2] Update .changeset/big-rabbits-think.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/big-rabbits-think.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/big-rabbits-think.md b/.changeset/big-rabbits-think.md index 53c8f0b03a..bd0ae32b5e 100644 --- a/.changeset/big-rabbits-think.md +++ b/.changeset/big-rabbits-think.md @@ -2,4 +2,4 @@ '@backstage/plugin-catalog-react': patch --- -Fixes a bug where the EntityListProvider would not correctly hydrate queryParameters if more than 20 were provided for the same key. +Fixes a bug where the `EntityListProvider` would not correctly hydrate query parameters if more than 20 were provided for the same key.