Skip to content

Commit

Permalink
reset nav stacks on account switch
Browse files Browse the repository at this point in the history
  • Loading branch information
armaniferrante committed Mar 10, 2023
1 parent edf1509 commit 823a0d3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/background/src/backend/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ import type { EthereumConnectionBackend } from "./ethereum-connection";
import { KeyringStore } from "./keyring";
import type { SolanaConnectionBackend } from "./solana-connection";
import type { Nav, User } from "./store";
import { getNav , getWalletDataForUser, setUser, setWalletDataForUser } from "./store";
import * as store from "./store";
import { getWalletDataForUser, setUser, setWalletDataForUser } from "./store";

const { base58: bs58 } = ethers.utils;

Expand Down Expand Up @@ -636,6 +636,21 @@ export class Backend {
const xnftPreferences = await this.getXnftPreferences();
const blockchainKeyrings = await this.blockchainKeyringsRead();

// Reset the navigation to the default everytime we switch users
// but keep the active tab.
const { activeTab } = (await store.getNav())!;
await store.setNav({
...defaultNav,
activeTab,
});
const url = defaultNav.data[activeTab].urls[0];
this.events.emit(BACKEND_EVENT, {
name: NOTIFICATION_NAVIGATION_URL_DID_CHANGE,
data: {
url,
},
});

// Push it.
this.events.emit(BACKEND_EVENT, {
name: NOTIFICATION_KEYRING_STORE_ACTIVE_USER_UPDATED,
Expand Down

1 comment on commit 823a0d3

@vercel
Copy link

@vercel vercel bot commented on 823a0d3 Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.