Don't clear #conversejs
via innerHTML
It appears to break subsequent lit-html `render` calls on the `#conversejs` element because lit-html still remembers parts from before the element was cleared.
This commit is contained in:
parent
2fcce78144
commit
696c8e3522
@ -71,7 +71,9 @@ converse.plugins.add('converse-chatboxviews', {
|
||||
/* Override method from backbone.js
|
||||
* If the #conversejs element doesn't exist, create it.
|
||||
*/
|
||||
if (!this.el) {
|
||||
if (this.el) {
|
||||
this.setElement(result(this, 'el'), false);
|
||||
} else {
|
||||
let el = _converse.root.querySelector('#conversejs');
|
||||
if (el === null) {
|
||||
el = document.createElement('div');
|
||||
@ -85,10 +87,7 @@ converse.plugins.add('converse-chatboxviews', {
|
||||
_converse.root.appendChild(el);
|
||||
}
|
||||
}
|
||||
el.innerHTML = '';
|
||||
this.setElement(el, false);
|
||||
} else {
|
||||
this.setElement(result(this, 'el'), false);
|
||||
}
|
||||
},
|
||||
|
||||
@ -108,19 +107,17 @@ converse.plugins.add('converse-chatboxviews', {
|
||||
},
|
||||
|
||||
render () {
|
||||
try {
|
||||
render(tpl_converse(), this.el);
|
||||
} catch (e) {
|
||||
this._ensureElement();
|
||||
render(tpl_converse(), this.el);
|
||||
}
|
||||
this._ensureElement();
|
||||
render(tpl_converse(), this.el);
|
||||
this.row_el = this.el.querySelector('.row');
|
||||
},
|
||||
|
||||
/*(
|
||||
* Add a new DOM element (likely a chat box) into the
|
||||
* the row managed by this overview.
|
||||
* @param { HTMLElement } el
|
||||
*/
|
||||
insertRowColumn (el) {
|
||||
/* Add a new DOM element (likely a chat box) into the
|
||||
* the row managed by this overview.
|
||||
*/
|
||||
this.row_el.insertAdjacentElement('afterBegin', el);
|
||||
},
|
||||
|
||||
@ -135,10 +132,7 @@ converse.plugins.add('converse-chatboxviews', {
|
||||
|
||||
|
||||
/************************ BEGIN Event Handlers ************************/
|
||||
api.listen.on('cleanup', () => {
|
||||
_converse?.chatboxviews.remove();
|
||||
delete _converse.chatboxviews;
|
||||
});
|
||||
api.listen.on('cleanup', () => (delete _converse.chatboxviews));
|
||||
|
||||
api.listen.on('chatBoxesInitialized', () => {
|
||||
_converse.chatboxviews = new _converse.ChatBoxViews({
|
||||
|
@ -424,6 +424,9 @@ export const api = _converse.api = {
|
||||
* event handlers' promises have been resolved.
|
||||
*/
|
||||
async trigger (name) {
|
||||
if (!_converse._events) {
|
||||
return;
|
||||
}
|
||||
const args = Array.from(arguments);
|
||||
const options = args.pop();
|
||||
if (options && options.synchronous) {
|
||||
@ -1310,7 +1313,7 @@ async function getLoginCredentialsFromBrowser () {
|
||||
// Make sure everything is reset in case this is a subsequent call to
|
||||
// converse.initialize (happens during tests).
|
||||
async function cleanup () {
|
||||
await _converse.api.trigger('cleanup', {'synchronous': true});
|
||||
await api.trigger('cleanup', {'synchronous': true});
|
||||
_converse.router.history.stop();
|
||||
unregisterGlobalEventHandlers();
|
||||
_converse.connection?.reset();
|
||||
|
Loading…
Reference in New Issue
Block a user