fix(dapp-v2): ensure dapp always resets on attempted disconnect
This commit is contained in:
parent
5c1092b9ef
commit
609a3239c6
@ -182,12 +182,18 @@ export function ClientContextProvider({
|
|||||||
if (typeof session === "undefined") {
|
if (typeof session === "undefined") {
|
||||||
throw new Error("Session is not connected");
|
throw new Error("Session is not connected");
|
||||||
}
|
}
|
||||||
await client.disconnect({
|
|
||||||
topic: session.topic,
|
try {
|
||||||
reason: getSdkError("USER_DISCONNECTED"),
|
await client.disconnect({
|
||||||
});
|
topic: session.topic,
|
||||||
// Reset app state after disconnect.
|
reason: getSdkError("USER_DISCONNECTED"),
|
||||||
reset();
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error("SignClient.disconnect failed:", error);
|
||||||
|
} finally {
|
||||||
|
// Reset app state after disconnect.
|
||||||
|
reset();
|
||||||
|
}
|
||||||
}, [client, session]);
|
}, [client, session]);
|
||||||
|
|
||||||
const _subscribeToEvents = useCallback(
|
const _subscribeToEvents = useCallback(
|
||||||
|
Loading…
Reference in New Issue
Block a user