Skip to content

Commit 35585fa

Browse files
committed
fix: setting the first n/w when custom n/ws contains only 1 item + shortened zk chains display names in n/w dropdown
1 parent 2b1230f commit 35585fa

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/components/Output.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,15 @@ export const Output = ({
154154
// when the default dest n/w is changed
155155
useEffect(() => {
156156
if (!firstNetworkRender && defaultDestNetwork) {
157-
updateNetwork(
158-
supportedNetworks?.find(
159-
(x: Network) => x.chainId === defaultDestNetwork
160-
)
161-
);
157+
if (supportedNetworks?.length === 1) {
158+
updateNetwork(supportedNetworks[0]);
159+
} else {
160+
updateNetwork(
161+
supportedNetworks?.find(
162+
(x: Network) => x.chainId === defaultDestNetwork
163+
)
164+
);
165+
}
162166
}
163167
}, [supportedNetworks, defaultDestNetwork]);
164168

src/components/common/ChainSelect.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function Option({
2626
borderRadius?: number;
2727
onlyOneNetwork?: boolean;
2828
}) {
29+
const networkDisplayName = network?.chainId === 1101 ? 'zkEVM' : network?.chainId === 324 ? 'zkSync' : network?.name;
2930
return (
3031
<div
3132
className={`skt-w skt-w-flex skt-w-w-28 skt-w-items-center skt-w-cursor-pointer skt-w-flex-shrink-0 ${
@@ -42,7 +43,7 @@ function Option({
4243
style={{ borderRadius: `calc(0.3rem * ${borderRadius})` }}
4344
/>
4445
<span className="skt-w skt-w-text-sm skt-w-text-widget-primary skt-w-mx-1">
45-
{network?.name}
46+
{networkDisplayName}
4647
</span>
4748
</div>
4849
{selected && !onlyOneNetwork && (

0 commit comments

Comments
 (0)