mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
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>
|
||||
${this._renderAIOnboarding()}
|
||||
</div> `
|
||||
: repeat(filteredItems, (item, index) => {
|
||||
const isLast = index === filteredItems.length - 1;
|
||||
return html`<div class="message">
|
||||
${this.renderAvatar(item)}
|
||||
<div class="item-wrapper">${this.renderItem(item, isLast)}</div>
|
||||
</div>`;
|
||||
})}
|
||||
: repeat(
|
||||
filteredItems,
|
||||
item => ('role' in item ? item.id : item.sessionId),
|
||||
(item, index) => {
|
||||
const isLast = index === filteredItems.length - 1;
|
||||
return html`<div class="message">
|
||||
${this.renderAvatar(item)}
|
||||
<div class="item-wrapper">
|
||||
${this.renderItem(item, isLast)}
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
)}
|
||||
<chat-cards
|
||||
.updateContext=${this.updateContext}
|
||||
.host=${this.host}
|
||||
|
||||
Reference in New Issue
Block a user