mirror of
https://github.com/apache/superset.git
synced 2026-07-27 09:02:29 +00:00
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 <noreply@anthropic.com>
(cherry picked from commit f037449b75)
This commit is contained in:
committed by
Joe Li
parent
610d1c5998
commit
4e315fd769
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user