Skip to content

Commit 9db390b

Browse files
committed
Remove setTimeout from attachment list
1 parent d8acb0d commit 9db390b

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
<div
2-
*ngIf="isInited && orderedAttachments.length > 0"
3-
class="str-chat__attachment-list"
4-
>
1+
<div *ngIf="orderedAttachments.length > 0" class="str-chat__attachment-list">
52
<ng-container
63
*ngFor="let attachment of orderedAttachments; trackBy: trackByUrl"
74
>

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
AfterViewInit,
32
Component,
43
EventEmitter,
54
HostBinding,
@@ -34,7 +33,7 @@ import { ThemeService } from '../theme.service';
3433
templateUrl: './attachment-list.component.html',
3534
styles: [],
3635
})
37-
export class AttachmentListComponent implements OnChanges, AfterViewInit {
36+
export class AttachmentListComponent implements OnChanges {
3837
/**
3938
* The id of the message the attachments belong to
4039
*/
@@ -57,7 +56,6 @@ export class AttachmentListComponent implements OnChanges, AfterViewInit {
5756
orderedAttachments: Attachment<DefaultStreamChatGenerics>[] = [];
5857
imagesToView: Attachment<DefaultStreamChatGenerics>[] = [];
5958
imagesToViewCurrentIndex = 0;
60-
isInited = false;
6159
themeVersion: '1' | '2';
6260
@ViewChild('modalContent', { static: true })
6361
private modalContent!: TemplateRef<void>;
@@ -96,13 +94,6 @@ export class AttachmentListComponent implements OnChanges, AfterViewInit {
9694
}
9795
}
9896

99-
ngAfterViewInit(): void {
100-
// Wait next tick to make sure CSS rules are properly applied
101-
setTimeout(() => {
102-
this.isInited = true;
103-
}, 0);
104-
}
105-
10697
trackByUrl(_: number, attachment: Attachment) {
10798
return (
10899
attachment.image_url ||

0 commit comments

Comments
 (0)