Possibly fix weird race conditions
No idea how this happen at all
This commit is contained in:
parent
2bc24cc495
commit
1692637e22
|
@ -27,9 +27,10 @@ function NavMenu(props) {
|
|||
|
||||
const [currentAccount, moreThanOneAccount] = useMemo(() => {
|
||||
const accounts = store.local.getJSON('accounts') || [];
|
||||
const acc = accounts.find(
|
||||
(account) => account.info.id === store.session.get('currentAccount'),
|
||||
);
|
||||
const acc =
|
||||
accounts.find(
|
||||
(account) => account.info.id === store.session.get('currentAccount'),
|
||||
) || accounts[0];
|
||||
return [acc, accounts.length > 1];
|
||||
}, []);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import store from './store';
|
|||
|
||||
export function getAccount(id) {
|
||||
const accounts = store.local.getJSON('accounts') || [];
|
||||
if (!id) return accounts[0];
|
||||
return accounts.find((a) => a.info.id === id) || accounts[0];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue