From 38e3fe8cc1f1899c79ac05e1e58f21c817a848e5 Mon Sep 17 00:00:00 2001 From: Peter Kieltyka Date: Wed, 1 May 2024 11:36:24 -0400 Subject: [PATCH] skip setup if in ssr mode --- .../wagmiConnectors/sequenceWaasConnector.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/connectors/src/connectors/wagmiConnectors/sequenceWaasConnector.ts b/packages/connectors/src/connectors/wagmiConnectors/sequenceWaasConnector.ts index e4a700ef..eae91de3 100644 --- a/packages/connectors/src/connectors/wagmiConnectors/sequenceWaasConnector.ts +++ b/packages/connectors/src/connectors/wagmiConnectors/sequenceWaasConnector.ts @@ -72,6 +72,11 @@ export function sequenceWaasWallet(params: BaseSequenceWaasConnectorOptions) { params, async setup() { + if (typeof window !== 'object') { + // (for SSR) only run in browser client + return + } + const provider = await this.getProvider() if (params.googleClientId) { @@ -86,11 +91,8 @@ export function sequenceWaasWallet(params: BaseSequenceWaasConnectorOptions) { const isConnected = await provider.sequenceWaas.isSignedIn() if (!isConnected) { - if (typeof window === 'object') { - // (for SSR) only run in browser client - const sessionHash = await provider.sequenceWaas.getSessionHash() - await config.storage?.setItem(LocalStorageKey.WaasSessionHash, sessionHash) - } + const sessionHash = await provider.sequenceWaas.getSessionHash() + await config.storage?.setItem(LocalStorageKey.WaasSessionHash, sessionHash) } provider.on('disconnect', () => {