[MM-38524] Rework the closing and opening tab logic, fixed login issue (#1735)

* Rework the closing and opening tab logic to better suit adding and removing servers

* A couple more fixes

* Lint fix

* [MM-38524] Fix login issue

* Remove unneeded code
This commit is contained in:
Devin Binnie
2021-09-16 13:35:07 -04:00
committed by GitHub
parent df57051eaa
commit b25ccfeecf
12 changed files with 76 additions and 55 deletions

View File

@@ -15,7 +15,6 @@ import {CombinedConfig, LocalConfiguration, Team} from 'types/config';
import {DeepPartial} from 'types/utils';
import {GET_LOCAL_CONFIGURATION, UPDATE_CONFIGURATION, DOUBLE_CLICK_ON_WINDOW, GET_DOWNLOAD_LOCATION, ADD_SERVER, RELOAD_CONFIGURATION} from 'common/communication';
import {getDefaultTeamWithTabsFromTeam} from 'common/tabs/TabView';
import AutoSaveIndicator, {SavingState} from './AutoSaveIndicator';
@@ -349,23 +348,6 @@ export default class SettingsPage extends React.PureComponent<Record<string, nev
allowSaveSpellCheckerURL,
});
}
updateTeam = (index: number, newData: Team) => {
const teams = this.state.teams || [];
teams[index] = newData;
window.timers.setImmediate(this.saveSetting, CONFIG_TYPE_SERVERS, {key: 'teams', data: teams});
this.setState({
teams,
});
}
addServer = (team: Team) => {
const teams = this.state.teams || [];
teams.push(getDefaultTeamWithTabsFromTeam(team));
window.timers.setImmediate(this.saveSetting, CONFIG_TYPE_SERVERS, {key: 'teams', data: teams});
this.setState({
teams,
});
}
handleDoubleClick = () => {
window.ipcRenderer.send(DOUBLE_CLICK_ON_WINDOW, 'settings');