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
|
/* Override method from backbone.js
|
||||||
* If the #conversejs element doesn't exist, create it.
|
* 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');
|
let el = _converse.root.querySelector('#conversejs');
|
||||||
if (el === null) {
|
if (el === null) {
|
||||||
el = document.createElement('div');
|
el = document.createElement('div');
|
||||||
@ -85,10 +87,7 @@ converse.plugins.add('converse-chatboxviews', {
|
|||||||
_converse.root.appendChild(el);
|
_converse.root.appendChild(el);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
el.innerHTML = '';
|
|
||||||
this.setElement(el, false);
|
this.setElement(el, false);
|
||||||
} else {
|
|
||||||
this.setElement(result(this, 'el'), false);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -108,19 +107,17 @@ converse.plugins.add('converse-chatboxviews', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
try {
|
this._ensureElement();
|
||||||
render(tpl_converse(), this.el);
|
render(tpl_converse(), this.el);
|
||||||
} catch (e) {
|
|
||||||
this._ensureElement();
|
|
||||||
render(tpl_converse(), this.el);
|
|
||||||
}
|
|
||||||
this.row_el = this.el.querySelector('.row');
|
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) {
|
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);
|
this.row_el.insertAdjacentElement('afterBegin', el);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -135,10 +132,7 @@ converse.plugins.add('converse-chatboxviews', {
|
|||||||
|
|
||||||
|
|
||||||
/************************ BEGIN Event Handlers ************************/
|
/************************ BEGIN Event Handlers ************************/
|
||||||
api.listen.on('cleanup', () => {
|
api.listen.on('cleanup', () => (delete _converse.chatboxviews));
|
||||||
_converse?.chatboxviews.remove();
|
|
||||||
delete _converse.chatboxviews;
|
|
||||||
});
|
|
||||||
|
|
||||||
api.listen.on('chatBoxesInitialized', () => {
|
api.listen.on('chatBoxesInitialized', () => {
|
||||||
_converse.chatboxviews = new _converse.ChatBoxViews({
|
_converse.chatboxviews = new _converse.ChatBoxViews({
|
||||||
|
@ -424,6 +424,9 @@ export const api = _converse.api = {
|
|||||||
* event handlers' promises have been resolved.
|
* event handlers' promises have been resolved.
|
||||||
*/
|
*/
|
||||||
async trigger (name) {
|
async trigger (name) {
|
||||||
|
if (!_converse._events) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const args = Array.from(arguments);
|
const args = Array.from(arguments);
|
||||||
const options = args.pop();
|
const options = args.pop();
|
||||||
if (options && options.synchronous) {
|
if (options && options.synchronous) {
|
||||||
@ -1310,7 +1313,7 @@ async function getLoginCredentialsFromBrowser () {
|
|||||||
// Make sure everything is reset in case this is a subsequent call to
|
// Make sure everything is reset in case this is a subsequent call to
|
||||||
// converse.initialize (happens during tests).
|
// converse.initialize (happens during tests).
|
||||||
async function cleanup () {
|
async function cleanup () {
|
||||||
await _converse.api.trigger('cleanup', {'synchronous': true});
|
await api.trigger('cleanup', {'synchronous': true});
|
||||||
_converse.router.history.stop();
|
_converse.router.history.stop();
|
||||||
unregisterGlobalEventHandlers();
|
unregisterGlobalEventHandlers();
|
||||||
_converse.connection?.reset();
|
_converse.connection?.reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user