Skip to content

Commit 8ee479e

Browse files
committed
fix: connected account
1 parent 2f91058 commit 8ee479e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

apps/dialog/src/main.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,15 @@ const offInitialized = Events.onInitialized(porto, async (payload, event) => {
8383
const offDialogRequest = Events.onDialogRequest(
8484
porto,
8585
async ({ account, request }) => {
86-
// Clear errors when the request is null (i.e. when the dialog is closed).
87-
if (!request) return Dialog.store.setState({ error: null })
88-
8986
const connectedAccount = porto._internal.store.getState().accounts[0]
9087

91-
// Clear the dialog accounts if disconnected
92-
if (!account && connectedAccount?.address)
93-
porto._internal.store.setState((x) => ({ ...x, accounts: [] }))
94-
9588
const requireAccountSync =
9689
account &&
97-
(!connectedAccount?.address ||
98-
!Address.isEqual(account.address, connectedAccount.address))
90+
connectedAccount?.address &&
91+
!Address.isEqual(account.address, connectedAccount.address)
92+
93+
// Clear errors when the request is null (i.e. when the dialog is closed).
94+
if (!request) return Dialog.store.setState({ error: null })
9995

10096
if (requireAccountSync) {
10197
await Router.router.navigate({

0 commit comments

Comments
 (0)