fix(scan): honour ?network= on home + list + leaderboard pages#57
Merged
github-actions[bot] merged 1 commit intoMay 11, 2026
Merged
Conversation
Audit on 2026-05-11 caught 22 client-side pages calling useNetwork() without the matching useNetworkFromQuery() — meaning a deeplink like https://scan.sentrixchain.com/?network=testnet rendered MAINNET data because the cookie never flipped. Detail pages already had the call (blocks/[height], tx/[hash], address/[addr], tokens/[addr]). Home + every list page + every leaderboard subpage was missing it. This PR adds the one-line call across all 22 sites with a consistent comment so future pages follow the pattern. Verified live before fix: GET /?network=testnet → page rendered height ~1,681,800 (mainnet) instead of ~3,172,785 (testnet) After fix the cookie flips on first render and the page swaps to the correct network's data. Typecheck clean.
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
Deep audit found 22 client-side pages calling
useNetwork()without the matchinguseNetworkFromQuery()hook. Result: deeplinks likehttps://scan.sentrixchain.com/blocks?network=testnet(the V1 mainnet host with a network query override) rendered mainnet data because the network cookie never flipped on first load.Detail pages (
blocks/[height],tx/[hash],address/[addr],tokens/[addr]) were correct. Everything else — home, blocks list, validators, tokens list, leaderboard subpages, search, sentinel, accounts, gas, supply, epochs, contracts, mempool, analytics, api-docs, forks — missed the hook.Why this matters when each network has its own subdomain
Canonical access is via dedicated subdomain, not the query string:
scan.sentrixchain.comscan.sentriscloud.comscan-testnet.sentrixchain.comscan-testnet.sentriscloud.comThe
?network=query exists as a cross-domain fallback for inbound deeplinks from other apps that aren't network-aware (faucet success page, wallet notifications, partner emails — all places where a single template URL gets reused with a network suffix). Without this fix, those links land on the right domain but the wrong cookie, so the user sees a network mismatch on first paint.Reproduction (pre-fix, verified live)
The cookie carried mainnet, the URL hinted testnet, the page rendered with the cookie's network and ignored the URL hint.
Fix
One-line call to
useNetworkFromQuery()after eachuseNetwork()call site, with a consistent comment so future pages follow the pattern:22 files modified, all in
apps/scan/app/[locale]/.Verification
pnpm --filter @sentriscloud/scan typecheckcleanhttps://scan.sentrixchain.com/blocks?network=testnetshows testnet block heights (~3.17M), not mainnet.https://scan-testnet.sentrixchain.com/...flow is unchanged — that path was never broken.Related work today
Test plan
https://scan.sentrixchain.com/blocks?network=testnetlists testnet blocks (~3.17M heights), not mainnetscan-testnet.sentrixchain.com) still works as before