Skip to content

Don't clear selected log entry in structured logs if filters are removed#15825

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-log-entry-clear-on-filter-remove
Draft

Don't clear selected log entry in structured logs if filters are removed#15825
Copilot wants to merge 2 commits intomainfrom
copilot/fix-log-entry-clear-on-filter-remove

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Clearing the selected entry on any filter change was overly aggressive — removing a filter can only expand the result set, so the current selection is always still valid in that case.

Changes

  • StructuredLogs.razor.csHandleSelectedLogLevelChangedAsync: Skip ClearSelectedLogEntryAsync when the log level is reset to "All" (null). Only clear when a restrictive level filter is applied.

  • Resources.razor.csVisibleResourcesChangedAsync: Replace the unconditional ClearSelectedResourceAsync() call with a check against the existing Filter() predicate. The selection is only cleared when the selected resource no longer passes the active filters. This covers all filter variants (type, state, health state, text search) correctly in both directions — a removed filter preserves selection, an added filter that excludes the selection still clears it.

// Before
await ClearSelectedResourceAsync();

// After — only clear if selected resource is filtered out
if (SelectedResource is null || !Filter(SelectedResource))
{
    await ClearSelectedResourceAsync();
}

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
    • No

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dnceng.pkgs.visualstudio.com
    • Triggering command: /usr/share/dotnet/dotnet dotnet test tests/Aspire.Dashboard.Components.Tests/Aspire.Dashboard.Components.Tests.csproj -- --filter-not-trait quarantined=true --filter-not-trait outerloop=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

…s and resources pages

Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/dd8ac091-5148-4ce3-afd3-0ea1bf1ff747

Co-authored-by: maddymontaquila <12660687+maddymontaquila@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix clearing selection of log entry when filters are removed Don't clear selected log entry in structured logs if filters are removed Apr 2, 2026
Copilot AI requested a review from maddymontaquila April 3, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't clear selected log entry in structured logs if filters are removed

2 participants