mirror of https://github.com/keeweb/keeweb.git
Fixing async settings store
This commit is contained in:
parent
a9d3b08c49
commit
30a31aa8b1
|
@ -17,6 +17,7 @@ const FileInfoCollection = Backbone.Collection.extend({
|
|||
onLoaded: function(data) {
|
||||
if (data) {
|
||||
this.reset(data, { silent: true });
|
||||
this.trigger('change', this);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ const SettingsStore = {
|
|||
Launcher.fileExists(settingsFile, exists => {
|
||||
if (exists) {
|
||||
Launcher.readFile(settingsFile, data => {
|
||||
callback(JSON.parse(data));
|
||||
const contents = typeof data === 'string' ? data : String.fromCharCode.apply(null, data);
|
||||
callback(JSON.parse(contents));
|
||||
}, err => { // eslint-disable-line handle-callback-err
|
||||
callback(undefined);
|
||||
});
|
||||
|
|
|
@ -58,6 +58,7 @@ const AppView = Backbone.View.extend({
|
|||
this.listenTo(this.model.settings, 'change:locale', this.setLocale);
|
||||
this.listenTo(this.model.settings, 'change:fontSize', this.setFontSize);
|
||||
this.listenTo(this.model.files, 'update reset', this.fileListUpdated);
|
||||
this.listenTo(this.model.fileInfos, 'change', this.render);
|
||||
|
||||
this.listenTo(Backbone, 'select-all', this.selectAll);
|
||||
this.listenTo(Backbone, 'menu-select', this.menuSelect);
|
||||
|
@ -253,6 +254,7 @@ const AppView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
fileListUpdated: function() {
|
||||
console.log('fileListUpdated');
|
||||
if (this.model.files.hasOpenFiles()) {
|
||||
this.showEntries();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue