fix: Handle pagination in chains API to fetch all chains#224
Merged
Conversation
The Safe Config Service API returns paginated results with a limit of 40 chains per page. Previously, only the first page was fetched, resulting in missing chains when the total count exceeded 40. This change implements proper pagination handling by: - Iterating through all pages until 'next' is null - Concatenating results from each page into a complete list - Ensuring all chains are loaded regardless of pagination Fixes the issue where only 40 of 41 available chains were displayed. Co-authored-by: Cursor <cursoragent@cursor.com>
Uxio0
approved these changes
Feb 16, 2026
The Safe Config Service API returns paginated results with a limit of 40 chains per page. Previously, only the first page was fetched, resulting in missing chains when the total count exceeded 40. This change implements proper pagination handling by: - Iterating through all pages until 'next' is null - Concatenating results from each page into a complete list - Ensuring all chains are loaded regardless of pagination Fixes the issue where only 40 of 41 available chains were displayed. Co-authored-by: Cursor <cursoragent@cursor.com>
…ansaction-service-status-page into fix/chains-api-limit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
Fixes pagination handling in the chains API to fetch all available chains from the Safe Config Service.
🐛 Problem
The Safe Config Service API (
https://safe-config.safe.global/api/v1/chains/) returns paginated results with a default limit of 40 chains per page. The current implementation only fetched the first page, which meant:✅ Solution
Updated the
getChainsfunction to handle pagination properly by:whileloop that iterates through all pagesnextURL from each response until it becomesnull🔍 Changes
File:
src/api/getChains.tsxallChainsarraynextisnull🧪 Testing
📊 Impact