Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Add manual sync points to the service store.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGoddessInari committed Nov 24, 2020
1 parent ce902fb commit 3becc15
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
9 changes: 6 additions & 3 deletions app/ux/FileBackup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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']
Expand All @@ -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();
});

Expand Down
5 changes: 3 additions & 2 deletions app/view/add/AddController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 3 additions & 2 deletions app/view/main/MainController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down

0 comments on commit 3becc15

Please sign in to comment.