mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-03 05:34:23 -04:00
Fix account deselecting itself sometimes
This commit is contained in:
parent
a0c1fdbd74
commit
b323736774
@ -102,8 +102,11 @@ export const updateAccount = (id: string, account: Account) => {
|
|||||||
const idx = accounts.findIndex((x) => x.id == id);
|
const idx = accounts.findIndex((x) => x.id == id);
|
||||||
if (idx === -1) return;
|
if (idx === -1) return;
|
||||||
|
|
||||||
if (account.selected) {
|
const selected = account.selected;
|
||||||
|
if (selected) {
|
||||||
for (const acc of accounts) acc.selected = false;
|
for (const acc of accounts) acc.selected = false;
|
||||||
|
// if account was already on the accounts list, we keep it selected.
|
||||||
|
account.selected = selected;
|
||||||
} else if (accounts[idx].selected) {
|
} else if (accounts[idx].selected) {
|
||||||
// we just unselected the current account, focus another one.
|
// we just unselected the current account, focus another one.
|
||||||
if (accounts.length > 0) accounts[0].selected = true;
|
if (accounts.length > 0) accounts[0].selected = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user