diff --git a/packages/reef-knot/CHANGELOG.md b/packages/reef-knot/CHANGELOG.md index dbe1c3d4..0560fa25 100644 --- a/packages/reef-knot/CHANGELOG.md +++ b/packages/reef-knot/CHANGELOG.md @@ -1,5 +1,12 @@ # reef-knot +## 1.11.1 + +### Patch Changes + +- Updated dependencies + - @reef-knot/web3-react@1.9.1 + ## 1.10.7 ### Patch Changes diff --git a/packages/reef-knot/package.json b/packages/reef-knot/package.json index 7ec8c264..67dbf945 100644 --- a/packages/reef-knot/package.json +++ b/packages/reef-knot/package.json @@ -1,6 +1,6 @@ { "name": "reef-knot", - "version": "1.11.0", + "version": "1.11.1", "main": "dist/index.js", "types": "dist/index.d.ts", "exports": { @@ -43,7 +43,7 @@ "dependencies": { "@reef-knot/connect-wallet-modal": "1.11.0", "@reef-knot/core-react": "1.7.0", - "@reef-knot/web3-react": "1.9.0", + "@reef-knot/web3-react": "1.9.1", "@reef-knot/ui-react": "1.0.7", "@reef-knot/wallets-icons": "1.3.0", "@reef-knot/wallets-list": "1.7.0", diff --git a/packages/web3-react/CHANGELOG.md b/packages/web3-react/CHANGELOG.md index fb059801..579c0ee5 100644 --- a/packages/web3-react/CHANGELOG.md +++ b/packages/web3-react/CHANGELOG.md @@ -1,5 +1,11 @@ # @reef-knot/web3-react +## 1.9.1 + +### Patch Changes + +- Fix an issue with the terms modal not closing until page restart. + ## 1.9.0 ### Minor Changes diff --git a/packages/web3-react/package.json b/packages/web3-react/package.json index 55106add..1b140ef8 100644 --- a/packages/web3-react/package.json +++ b/packages/web3-react/package.json @@ -1,6 +1,6 @@ { "name": "@reef-knot/web3-react", - "version": "1.9.0", + "version": "1.9.1", "main": "dist/index.js", "types": "dist/index.d.ts", "exports": { diff --git a/packages/web3-react/src/hooks/useAutoConnect.ts b/packages/web3-react/src/hooks/useAutoConnect.ts index b932f0ab..f0055924 100644 --- a/packages/web3-react/src/hooks/useAutoConnect.ts +++ b/packages/web3-react/src/hooks/useAutoConnect.ts @@ -10,6 +10,13 @@ import { useDisconnect } from './useDisconnect'; import { ConnectorsContextValue } from '../context'; import { isDappBrowserProvider } from '../helpers'; +const isTermsAccepted = () => { + if (typeof window !== 'undefined') { + return window.localStorage?.getItem(LS_KEY_TERMS_ACCEPTANCE) === 'true'; + } + return false; +}; + export const useAutoConnect = (connectors: ConnectorsContextValue) => { useEagerConnector(connectors); useSaveConnectorToLS(); @@ -59,7 +66,7 @@ export const useEagerConnector = (connectors: ConnectorsContextValue) => { error = e as Error; } if (shouldAutoConnectApp) { - if (!termsAccepted || error) { + if (!isTermsAccepted() || error) { acceptTermsModal.setError?.(error); acceptTermsModal.setVisible?.(true); } else { @@ -69,13 +76,7 @@ export const useEagerConnector = (connectors: ConnectorsContextValue) => { } }; - let termsAccepted = false; - if (typeof window !== 'undefined') { - termsAccepted = - window.localStorage?.getItem(LS_KEY_TERMS_ACCEPTANCE) === 'true'; - } - - if (shouldAutoConnectApp && !termsAccepted) { + if (shouldAutoConnectApp && !isTermsAccepted()) { acceptTermsModal.setOnContinue?.(() => connectWallet); acceptTermsModal.setVisible?.(true); return;