From 4e315fd7697d018cd544aafe55dac7a51e36bbf1 Mon Sep 17 00:00:00 2001 From: Elizabeth Thompson Date: Thu, 28 May 2026 13:34:54 -0700 Subject: [PATCH] fix(roles): resolve HTTP 429 errors on role management page (#39465) Adapted for 6.0-release: only the fetchOptions.ts concurrency throttle (429 fix) applies. The RoleListEditModal.tsx/test.tsx changes (414 fix) depend on the AsyncSelect architecture introduced in #38387, which is not present on 6.0; in 6.0 the modal receives permissions/groups as props from the parent list page rather than fetching them itself with id-IN filters, so the 414 URL-length code path does not exist here. Co-authored-by: Claude Sonnet 4.6 (cherry picked from commit f037449b753e187ee1522ad05fdd9c2466d55120) --- superset-frontend/src/utils/fetchOptions.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/superset-frontend/src/utils/fetchOptions.ts b/superset-frontend/src/utils/fetchOptions.ts index a09ca471e3e..fdbda706e18 100644 --- a/superset-frontend/src/utils/fetchOptions.ts +++ b/superset-frontend/src/utils/fetchOptions.ts @@ -87,16 +87,21 @@ export const fetchPaginatedData = async ({ } const totalPages = Math.ceil(totalItems / pageSize); + const concurrencyLimit = 5; + const allResults = [...firstPageResults]; - const requests = Array.from({ length: totalPages - 1 }, (_, i) => - fetchPage(i + 1), - ); - const remainingResults = await Promise.all(requests); + for (let batch = 1; batch < totalPages; batch += concurrencyLimit) { + const batchEnd = Math.min(batch + concurrencyLimit, totalPages); + // eslint-disable-next-line no-await-in-loop + const batchResults = await Promise.all( + Array.from({ length: batchEnd - batch }, (_, i) => + fetchPage(batch + i), + ), + ); + allResults.push(...batchResults.flatMap(res => res.results)); + } - setData([ - ...firstPageResults, - ...remainingResults.flatMap(res => res.results), - ]); + setData(allResults); } catch (err) { addDangerToast(t(errorMessage)); } finally {