db: Fix JSON db errors on tab switch.

This commit is contained in:
Kanishk Kakar
2019-06-19 23:56:07 +05:30
committed by Akash Nimare
parent 88b764dcc9
commit db4e8e5129
2 changed files with 6 additions and 2 deletions

View File

@@ -354,6 +354,10 @@ app.on('ready', () => {
ipcMain.on('error-reporting', event => {
event.sender.send('error-reporting-val', errorReporting);
});
ipcMain.on('save-last-tab', (event, index) => {
ConfigUtil.setConfigItem('lastActiveTab', index);
});
});
app.on('before-quit', () => {

View File

@@ -409,8 +409,8 @@ class ServerManagerView {
activateLastTab(index) {
// Open all the tabs in background, also activate the tab based on the index
this.activateTab(index);
// Save last active tab
ConfigUtil.setConfigItem('lastActiveTab', index);
// Save last active tab via main process to avoid JSON DB errors
ipcRenderer.send('save-last-tab', index);
}
// returns this.tabs in an way that does