Fixed the source counter of an answer doing nothing when clicked

This commit is contained in:
Thorsten Sommer committed 2026-09-15 17:38:36 +02:00
1 parent baa48c80e1
commit 408e06e9c0
4 files changed
+44 -3

No files matched your search

@@ -123,6 +123,7 @@ public partial class ContentBlockComponent : MSGComponentBase
private IReadOnlyList<MessageTable> cachedMessageTables = [];
private char csvSeparator = ',';
private ElementReference mathContentContainer;
private SourcesList? sourcesList;
private string lastMathRenderSignature = string.Empty;
private bool hasActiveMathContainer;
private bool isDisposed;
@@ -815,6 +816,25 @@ public partial class ContentBlockComponent : MSGComponentBase
this.Content.FileAttachments = [.. result];
}
/// <summary>
/// Whether the sources of this block stand below the answer, where the counter can take the reader.
/// </summary>
/// <remarks>
/// The same condition the block itself renders the list under. While an answer is still coming
/// in, its sources may already be known, but there is nothing on the page yet to scroll to --
/// so the counter says it cannot do anything rather than doing nothing when clicked.
/// </remarks>
private bool HasSourcesToShow => this.Content is { InitialRemoteWait: false, IsStreaming: false, Sources.Count: > 0 };
/// <summary>
/// Takes the reader from the source counter down to the sources themselves.
/// </summary>
private async Task ShowSources()
{
if (this.sourcesList is not null)
await this.sourcesList.ScrollIntoViewAsync();
}
protected override async ValueTask DisposeResourcesAsync()
{
if (this.isDisposed)