@using System.Collections.Specialized @using LANCommander.SDK.Services @using Microsoft.AspNetCore.Components.Web.Virtualization @inject IChatClient ChatClient @namespace LANCommander.UI.Components @if (_thread != null) { @foreach (var message in messageGroup.Messages) { } } @code { [Parameter] public Guid? Id { get; set; } SDK.Models.ChatThread? _thread; protected override async Task OnParametersSetAsync() { if ((_thread == null || _thread.Id != Id) && Id.HasValue) { _thread = await ChatClient.GetThreadAsync(Id.Value); _thread.MessageGroups.CollectionChanged += MessageGroupsOnCollectionChanged; await ChatClient.GetMessagesAsync(Id.Value); } } void MessageGroupsOnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) => InvokeAsync(StateHasChanged); }