Reduce the number of writes to the config (#2498)

* Add some logging, refactor setting config items

* Move active team to setMultiple, reduce serverInfos calls if the data is already the same

* Fix some logging

* Lint fix
This commit is contained in:
Devin Binnie
2023-01-12 08:46:06 -05:00
committed by GitHub
parent 9f6893fdb2
commit db76a67fb5
7 changed files with 62 additions and 30 deletions

View File

@@ -321,8 +321,10 @@ export function handleUpdateLastActive(event: IpcMainEvent, serverName: string,
team.lastActiveTab = viewOrder;
}
});
Config.set('teams', teams);
Config.set('lastActiveTeam', teams.find((team) => team.name === serverName)?.order || 0);
Config.setMultiple({
teams,
lastActiveTeam: teams.find((team) => team.name === serverName)?.order || 0,
});
}
export function handlePingDomain(event: IpcMainInvokeEvent, url: string): Promise<string> {