Skip to content

Commit 7ede361

Browse files
gregfromstlclaude
andauthored
Fix testnet filtering in NetworkSelectors (#7001)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8b50779 commit 7ede361

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)