Skip to content

Commit 6877c6b

Browse files
gregfromstlclaude
andcommitted
Fix testnet filtering in NetworkSelectors
Fixed issue with the disableTestnets filter in SingleNetworkSelector to properly filter out testnets regardless of chainIds being provided. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8b50779 commit 6877c6b

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

apps/dashboard/src/@/components/blocks/NetworkSelectors.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,18 @@ export function SingleNetworkSelector(props: {
151151
const { allChains, idToChain } = useAllChainsData();
152152

153153
const chainsToShow = useMemo(() => {
154-
if (!props.chainIds) {
155-
return allChains;
154+
let chains = allChains;
155+
156+
if (props.disableTestnets) {
157+
chains = chains.filter((chain) => !chain.testnet);
158+
}
159+
160+
if (props.chainIds) {
161+
const chainIdSet = new Set(props.chainIds);
162+
chains = chains.filter((chain) => chainIdSet.has(chain.chainId));
156163
}
157-
const chainIdSet = new Set(props.chainIds);
158-
return allChains.filter(
159-
(chain) =>
160-
chainIdSet.has(chain.chainId) &&
161-
(!props.disableTestnets || !chain.testnet),
162-
);
164+
165+
return chains;
163166
}, [allChains, props.chainIds, props.disableTestnets]);
164167

165168
const options = useMemo(() => {

0 commit comments

Comments
 (0)