From d8689a336adef3781fa8b03122d587b2b9edc820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Mar=C3=ADn?= Date: Fri, 15 Mar 2024 19:33:28 +0100 Subject: [PATCH] refactor: replace @ViewChildren, @ContentChild y @ContentChildren with signal counterparts --- .../src/lib/components/channel/ng-talk-channel.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/ng-talk/src/lib/components/channel/ng-talk-channel.component.ts b/projects/ng-talk/src/lib/components/channel/ng-talk-channel.component.ts index e51759f..554171d 100644 --- a/projects/ng-talk/src/lib/components/channel/ng-talk-channel.component.ts +++ b/projects/ng-talk/src/lib/components/channel/ng-talk-channel.component.ts @@ -13,7 +13,7 @@ import { QueryList, signal, SimpleChanges, - ViewChild, + ViewChild, viewChildren, ViewChildren } from '@angular/core'; import {takeUntilDestroyed} from "@angular/core/rxjs-interop"; @@ -56,7 +56,7 @@ export class NgTalkChannelComponent implements OnInit, OnChanges, AfterViewInit @ViewChild('chatBox') private _chatBox: ElementRef; @ViewChild(NgTalkSendMessageComponent) private _sendMessageComponent: NgTalkSendMessageComponent; - @ViewChildren(NgTalkChannelMessageComponent) private _messageComponents: QueryList; + private _messageComponents = viewChildren(NgTalkChannelMessageComponent); private _visibleMessages = 20; public messages = signal([]); @@ -169,7 +169,7 @@ export class NgTalkChannelComponent implements OnInit, OnChanges, AfterViewInit } public goToMessage(message: ChatMessage) { - const wrapper = this._messageComponents?.find(m => m.message === message || (m.message.id && message.id && m.message.id === message.id)); + const wrapper = this._messageComponents()?.find(m => m.message === message || (m.message.id && message.id && m.message.id === message.id)); wrapper?.highlight(); }