Chats: use repeat directive

This commit is contained in:
JC Brand 2021-01-30 15:47:17 +01:00
parent f33fa1e9fc
commit 28fb2472a4

View File

@ -1,4 +1,5 @@
import { html } from 'lit-html'; import { html } from 'lit-html';
import { repeat } from 'lit-html/directives/repeat.js';
import { _converse, api } from '@converse/headless/core'; import { _converse, api } from '@converse/headless/core';
export default () => { export default () => {
@ -7,7 +8,7 @@ export default () => {
return html` return html`
${view_mode === 'overlayed' ? html`<converse-minimized-chats></converse-minimized-chats>` : ''} ${view_mode === 'overlayed' ? html`<converse-minimized-chats></converse-minimized-chats>` : ''}
${chatboxes.map(m => { ${repeat(chatboxes, m => m.get('jid'), m => {
if (m.get('type') === CONTROLBOX_TYPE) { if (m.get('type') === CONTROLBOX_TYPE) {
return html` return html`
${view_mode === 'overlayed' ? html`<converse-controlbox-toggle class="${!m.get('closed') ? 'hidden' : ''}"></converse-controlbox-toggle>` : ''} ${view_mode === 'overlayed' ? html`<converse-controlbox-toggle class="${!m.get('closed') ? 'hidden' : ''}"></converse-controlbox-toggle>` : ''}