diff --git a/packages/ui-react/lib/components/Connect/hooks.tsx b/packages/ui-react/lib/components/Connect/hooks.tsx index 694aa0a4..a6f3feda 100644 --- a/packages/ui-react/lib/components/Connect/hooks.tsx +++ b/packages/ui-react/lib/components/Connect/hooks.tsx @@ -107,7 +107,10 @@ export const useConnect = () => { "" ) - const [accountLocalStorage] = useExtensionStorage(localStorageKeyAccount, "") + const [accountLocalStorage, setAccountLocalStorage] = useExtensionStorage( + localStorageKeyAccount, + "" + ) const [connectedAccounts, setConnectedAccounts] = useState< InjectedPolkadotAccount[] @@ -134,8 +137,9 @@ export const useConnect = () => { ) if (account.length) { setConnectedAccount(account[0]) + setAccountLocalStorage(account[0]) } - }, [accountLocalStorage, connectedAccounts]) + }, [accountLocalStorage, connectedAccounts, setAccountLocalStorage]) useEffect(() => { extensionsStore.revive(extensionLocalStorage) diff --git a/packages/ui-react/package.json b/packages/ui-react/package.json index 58e9a0be..c41d56ff 100644 --- a/packages/ui-react/package.json +++ b/packages/ui-react/package.json @@ -1,7 +1,7 @@ { "name": "@polkadot-ui/react", "license": "MIT", - "version": "0.0.1-alpha.26", + "version": "0.0.1-alpha.27", "author": "Nikolaos Kontakis", "type": "module", "description": "Functional React components for Polkadot dApps.", diff --git a/sandbox/src/pages/ConnectPage.tsx b/sandbox/src/pages/ConnectPage.tsx index 643a217d..1362f146 100644 --- a/sandbox/src/pages/ConnectPage.tsx +++ b/sandbox/src/pages/ConnectPage.tsx @@ -2,14 +2,9 @@ import { SelectedAccountType, ConnectConfiguration, ConnectExtensions, - localStorageKeyExtensions, - localStorageKeyAccount, Polkicon, } from "@packages/ui-react/lib/components" -import { - useConnect, - useExtensionStorage, -} from "@packages/ui-react/lib/components/Connect/hooks" +import { useConnect } from "@packages/ui-react/lib/components/Connect/hooks" import { Any } from "@packages/ui-react/lib/utils" import { useEffect, useState } from "react"