Skip to content

Commit 5cb1e29

Browse files
chore: improved logic
1 parent 78d3670 commit 5cb1e29

File tree

1 file changed

+5
-10
lines changed
  • packages/appkit/src/views/w3m-connecting-view

1 file changed

+5
-10
lines changed

packages/appkit/src/views/w3m-connecting-view/index.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function ConnectingView() {
3838
}
3939
};
4040

41-
const initializeConnection = async (retry = false, retryTimestamp?: number) => {
41+
const initializeConnection = async (retry = false) => {
4242
try {
4343
const { wcPairingExpiry } = WcController.state;
4444
const { data: routeData } = RouterController.state;
@@ -73,11 +73,9 @@ export function ConnectingView() {
7373
}
7474
});
7575

76-
const currentRetryTime = retryTimestamp ?? lastRetryRef.current;
77-
if (isQr && CoreHelperUtil.isAllowedRetry(currentRetryTime)) {
78-
const newRetryTime = Date.now();
79-
lastRetryRef.current = newRetryTime;
80-
initializeConnection(true, newRetryTime);
76+
if (isQr && CoreHelperUtil.isAllowedRetry(lastRetryRef.current)) {
77+
lastRetryRef.current = Date.now();
78+
initializeConnection(true);
8179
}
8280
}
8381
};
@@ -107,10 +105,7 @@ export function ConnectingView() {
107105
}, [data, isInstalled]);
108106

109107
useEffect(() => {
110-
// Clear any stale URI from previous connection attempts
111-
WcController.clearUri();
112-
113-
initializeConnection();
108+
initializeConnection(true);
114109
let _interval: NodeJS.Timeout;
115110

116111
// Check if the pairing expired every 10 seconds. If expired, it will create a new uri.

0 commit comments

Comments
 (0)