Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Aspire.Dashboard/Components/Pages/Resources.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,15 @@ private async Task HandleSearchFilterChangedAsync()
private async Task VisibleResourcesChangedAsync()
{
await UpdateResourceGraphResourcesAsync();
await ClearSelectedResourceAsync();

// Only clear the selected resource if it no longer passes the current filter.
// This preserves the selection when a filter is removed (result set expands) and
// the selected resource is still visible.
if (SelectedResource is null || !Filter(SelectedResource))
{
await ClearSelectedResourceAsync();
}

await _dataGrid.SafeRefreshDataAsync();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,14 @@ private async Task HandleSelectedLogLevelChangedAsync()
{
_resourceChanged = true;

await ClearSelectedLogEntryAsync();
// Only clear the selected log entry if a log level filter is being applied.
// If the log level is set to "All" (null), the filter is being removed and the
// selected entry is necessarily still in the results.
if (PageViewModel.SelectedLogLevel.Id is not null)
{
await ClearSelectedLogEntryAsync();
}

await this.AfterViewModelChangedAsync(_contentLayout, waitToApplyMobileChange: true);
}

Expand Down