Bugfix. Bookmarks list didn't remember toggle state

We need to wait for the state to be fetched from storage before
rendering the list.
This commit is contained in:
JC Brand 2019-03-27 08:34:58 +01:00
parent 298300e890
commit 6cbdaa0f4f
2 changed files with 16 additions and 6 deletions

13
dist/converse.js vendored
View File

@ -48940,9 +48940,16 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
'id': id
});
this.list_model.browserStorage = new Backbone.BrowserStorage[storage](id);
this.list_model.fetch();
this.render();
this.sortAndPositionAllItems();
const render = () => {
this.render();
this.sortAndPositionAllItems();
};
this.list_model.fetch({
'success': render,
'error': render
});
},
render() {

View File

@ -440,9 +440,12 @@ converse.plugins.add('converse-bookmarks', {
id = `converse.room-bookmarks${_converse.bare_jid}-list-model`;
this.list_model = new _converse.BookmarksList({'id': id});
this.list_model.browserStorage = new Backbone.BrowserStorage[storage](id);
this.list_model.fetch();
this.render();
this.sortAndPositionAllItems();
const render = () => {
this.render();
this.sortAndPositionAllItems();
}
this.list_model.fetch({'success': render, 'error': render});
},
render () {