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

@@ -127,6 +127,8 @@ export class ViewManager {
* close, open, or reload tabs, taking care to reuse tabs and
* preserve focus on the currently selected tab. */
reloadConfiguration = (configServers: TeamWithTabs[]) => {
log.debug('viewManager.reloadConfiguration');
const focusedTuple: TabTuple | undefined = this.views.get(this.currentView as string)?.urlTypeTuple;
const current: Map<TabTuple, MattermostView> = new Map();
@@ -199,6 +201,8 @@ export class ViewManager {
}
showInitial = () => {
log.verbose('viewManager.showInitial');
const servers = this.getServers();
if (servers.length) {
const element = servers.find((e) => e.order === this.lastActiveServer) || servers.find((e) => e.order === 0);