From 3becc15121c4588c1b67c10ffd16649b3926d03c Mon Sep 17 00:00:00 2001 From: TheGoddessInari Date: Tue, 24 Nov 2020 14:28:08 -0800 Subject: [PATCH] Add manual sync points to the service store. --- app/ux/FileBackup.js | 9 ++++++--- app/view/add/AddController.js | 5 +++-- app/view/main/MainController.js | 5 +++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/ux/FileBackup.js b/app/ux/FileBackup.js index 6d1083f64..9533b2420 100644 --- a/app/ux/FileBackup.js +++ b/app/ux/FileBackup.js @@ -13,7 +13,9 @@ Ext.define('Hamsket.ux.FileBackup', { backupConfiguration(callback) { const me = this; let services = []; - Ext.getStore('Services').each(function(service) { + const service_store = Ext.getStore('Services'); + service_store.sync(); + service_store.each(function(service) { const s = Ext.clone(service); delete s.data.id; delete s.data.zoomLevel; @@ -37,6 +39,7 @@ Ext.define('Hamsket.ux.FileBackup', { }, restoreConfiguration() { const me = this; + const service_store = Ext.getStore('Services'); me.remote.dialog.showOpenDialog({ defaultPath: me.myDefaultPath, properties: ['openFile'] @@ -52,9 +55,9 @@ Ext.define('Hamsket.ux.FileBackup', { Ext.cq1('app-main').getController().removeAllServices(true, function() { Ext.each(services, function(s) { const service = Ext.create('Hamsket.model.Service', s); - service.save(); - Ext.getStore('Services').add(service); + service_store.add(service); }); + service_store.sync(); me.remote.getCurrentWindow().reload(); }); diff --git a/app/view/add/AddController.js b/app/view/add/AddController.js index dda88a371..9aa01b42e 100644 --- a/app/view/add/AddController.js +++ b/app/view/add/AddController.js @@ -138,8 +138,9 @@ Ext.define('Hamsket.view.add.AddController', { ,os_override: formValues.os_override ,chrome_version: formValues.chrome_version }); - service.save(); - Ext.getStore('Services').add(service); + const service_store = Ext.getStore('Services'); + service_store.add(service); + service_store.sync(); const tabData = { xtype: 'webview' diff --git a/app/view/main/MainController.js b/app/view/main/MainController.js index 040f98267..d93b96038 100644 --- a/app/view/main/MainController.js +++ b/app/view/main/MainController.js @@ -166,11 +166,12 @@ Ext.define('Hamsket.view.main.MainController', { ); }) .finally(function() { + const service_store = Ext.getStore('Services'); // Remove record from localStorage - Ext.getStore('Services').remove(rec); + service_store.remove(rec); + service_store.sync(); // Close tab if (tab) tab.close(); - session.destroy(); if ( Ext.isFunction(resolve) ) resolve(); // Close waiting message if ( total === actual ) {