Skip to content

Commit 35dba67

Browse files
committed
fix: Track attachments by URL
1 parent c4c3c86 commit 35dba67

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

projects/stream-chat-angular/src/lib/attachment-list/attachment-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div *ngIf="orderedAttachments.length > 0" class="str-chat__attachment-list">
22
<ng-container
3-
*ngFor="let attachment of orderedAttachments; trackBy: trackByReference"
3+
*ngFor="let attachment of orderedAttachments; trackBy: trackByUrl"
44
>
55
<div
66
data-testclass="attachment-container"

projects/stream-chat-angular/src/lib/attachment-list/attachment-list.component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,13 @@ export class AttachmentListComponent implements OnChanges {
8383
}
8484
}
8585

86-
trackByReference(_: number, attachment: Attachment) {
87-
return attachment;
86+
trackByUrl(_: number, attachment: Attachment) {
87+
return (
88+
attachment.image_url ||
89+
attachment.img_url ||
90+
attachment.asset_url ||
91+
attachment.thumb_url
92+
);
8893
}
8994

9095
isImage(attachment: Attachment) {

0 commit comments

Comments
 (0)