Skip to content

Commit b360857

Browse files
committed
fix(ui): prevent fetching universal link on mount for mobile connection
1 parent bb0651a commit b360857

File tree

1 file changed

+9
-3
lines changed
  • packages/ui/src/app/views/modals/wallets-modal/mobile-universal-modal

1 file changed

+9
-3
lines changed

packages/ui/src/app/views/modals/wallets-modal/mobile-universal-modal/index.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ interface MobileUniversalModalProps {
4747
export const MobileUniversalModal: Component<MobileUniversalModalProps> = props => {
4848
const [showQR, setShowQR] = createSignal(false);
4949
const [firstClick, setFirstClick] = createSignal(true);
50+
const [universalLink, setUniversalLink] = createSignal<string | null>(null);
5051
const connector = appState.connector;
5152
const walletsList = (): WalletInfo[] =>
5253
props.walletsList.filter(w => supportsMobile(w) && w.appName !== AT_WALLET_APP_NAME);
@@ -56,9 +57,12 @@ export const MobileUniversalModal: Component<MobileUniversalModalProps> = props
5657
equals: bridgesIsEqual
5758
});
5859

59-
const getUniversalLink = createMemo((): string =>
60-
connector.connect(walletsBridges(), props.additionalRequest)
61-
);
60+
const getUniversalLink = (): string => {
61+
if (!universalLink()) {
62+
setUniversalLink(connector.connect(walletsBridges(), props.additionalRequest));
63+
}
64+
return universalLink()!;
65+
};
6266

6367
setLastSelectedWalletInfo({ openMethod: 'universal-link' });
6468

@@ -96,6 +100,8 @@ export const MobileUniversalModal: Component<MobileUniversalModalProps> = props
96100
};
97101

98102
const onSelectTelegram = (): void => {
103+
setUniversalLink(null);
104+
99105
const atWallet = props.walletsList.find(wallet => wallet.appName === AT_WALLET_APP_NAME);
100106
if (!atWallet || !isWalletInfoRemote(atWallet)) {
101107
throw new TonConnectUIError('@wallet bot not found in the wallets list');

0 commit comments

Comments
 (0)