fix(core): ai chat panel content will be inconsistent when switching to journals (#9288)
Fix issue [BS-2153](https://linear.app/affine-design/issue/BS-2153). Optimize DOM reuse by explicitly providing an identifier (similar to React's key).
This commit is contained in:
@@ -255,13 +255,19 @@ export class ChatPanelMessages extends WithDisposable(ShadowlessElement) {
|
|||||||
</div>
|
</div>
|
||||||
${this._renderAIOnboarding()}
|
${this._renderAIOnboarding()}
|
||||||
</div> `
|
</div> `
|
||||||
: repeat(filteredItems, (item, index) => {
|
: repeat(
|
||||||
const isLast = index === filteredItems.length - 1;
|
filteredItems,
|
||||||
return html`<div class="message">
|
item => ('role' in item ? item.id : item.sessionId),
|
||||||
${this.renderAvatar(item)}
|
(item, index) => {
|
||||||
<div class="item-wrapper">${this.renderItem(item, isLast)}</div>
|
const isLast = index === filteredItems.length - 1;
|
||||||
</div>`;
|
return html`<div class="message">
|
||||||
})}
|
${this.renderAvatar(item)}
|
||||||
|
<div class="item-wrapper">
|
||||||
|
${this.renderItem(item, isLast)}
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
|
)}
|
||||||
<chat-cards
|
<chat-cards
|
||||||
.updateContext=${this.updateContext}
|
.updateContext=${this.updateContext}
|
||||||
.host=${this.host}
|
.host=${this.host}
|
||||||
|
|||||||
Reference in New Issue
Block a user