Skip to content

Commit

Permalink
Fix: AppContextProvider fix autologin logic for embedded
Browse files Browse the repository at this point in the history
Fixes #4206
  • Loading branch information
rdig authored and jakubcolony committed Feb 5, 2025
1 parent fb28811 commit 0920d9d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/context/AppContext/AppContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,12 @@ const AppContextProvider = ({ children }: { children: ReactNode }) => {
const [walletConnecting, setWalletConnecting] = useState(false);
const { setShowAuthFlow, handleLogOut, primaryWallet } = useDynamicContext();
const [getUserByAddress] = useGetUserByAddressLazyQuery();
const [autoConnectedWalletType] = useLocalStorage(
DynamicLocalStorageKeys.CONNECTED_WALLETS,
undefined,
);
const [autoConnectedWalletAddress] = useLocalStorage(
DynamicLocalStorageKeys.CONNECTED_WALLET_NS,
undefined,
);
const [willWalletAutoConnect, setWillWalletAutoConnect] = useState(
(autoConnectedWalletType && autoConnectedWalletAddress) || false,
autoConnectedWalletAddress || false,
);

const {
Expand Down Expand Up @@ -182,7 +178,7 @@ const AppContextProvider = ({ children }: { children: ReactNode }) => {
}, []);

const clearDynamicWalletAutoLogin = useCallback(() => {
localStorage.removeItem(DynamicLocalStorageKeys.CONNECTED_WALLETS);
localStorage.removeItem(DynamicLocalStorageKeys.CONNECTED_WALLETS); // will not exist for embedded wallets
localStorage.removeItem(DynamicLocalStorageKeys.CONNECTED_WALLET_NS);
debugLogging('WALLET AUTOLOGIN CLEARED');
}, []);
Expand Down

0 comments on commit 0920d9d

Please sign in to comment.