Skip to content

Always update resource list in console logs after hidden bool changes#10705

Merged
JamesNK merged 2 commits intodotnet:mainfrom
adamint:dev/adamint/hidden-resource-stays-in-list-after-hide-resources
Jul 28, 2025
Merged

Always update resource list in console logs after hidden bool changes#10705
JamesNK merged 2 commits intodotnet:mainfrom
adamint:dev/adamint/hidden-resource-stays-in-list-after-hide-resources

Conversation

@adamint
Copy link
Member

@adamint adamint commented Jul 28, 2025

Description

The early return is actually incorrect, because the resource options always need to be updated after showHiddenResources changes. I added a test because this logic has been tricky to get right.

Fixes #10647

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
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@adamint adamint requested review from JamesNK and Copilot July 28, 2025 15:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug in the console logs component where the resource list wasn't being updated correctly when toggling hidden resource visibility. The early return after clearing the selected resource was preventing the necessary UI updates, causing inconsistent state between the hidden resources setting and the displayed resource options.

  • Removed the early return that was preventing resource list updates after hidden resource toggle
  • Moved UpdateResourcesList() and UpdateMenuButtons() calls before the selected resource clearing logic
  • Added comprehensive test coverage for the hidden resource toggle functionality

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Aspire.Dashboard/Components/Pages/ConsoleLogs.razor.cs Fixed the logic flow by ensuring resource list updates always occur when hidden resource visibility changes
tests/Aspire.Dashboard.Components.Tests/Pages/ConsoleLogsTests.cs Added comprehensive test to verify hidden resource toggle behavior and resource list updates
Comments suppressed due to low confidence (1)

tests/Aspire.Dashboard.Components.Tests/Pages/ConsoleLogsTests.cs:180

  • [nitpick] The test uses 'regular-resource' and 'hidden-resource' names which contain hyphens. Consider using camelCase or PascalCase naming that aligns with C# conventions, such as 'regularResource' and 'hiddenResource'.
        var regularResource = ModelTestHelpers.CreateResource(appName: "regular-resource", state: KnownResourceState.Running);

@JamesNK
Copy link
Member

JamesNK commented Jul 28, 2025

I think we should backport to 9.4.x. It's too late to put in 9.4 but there will be a service patch and we can include it then.

Can you handle creating the backport and communicating this.

@davidfowl
Copy link
Member

Let’s mark this as a 9.4.1 candidate

@JamesNK JamesNK merged commit c6554c6 into dotnet:main Jul 28, 2025
544 of 547 checks passed
@davidfowl davidfowl added this to the 9.5 milestone Jul 29, 2025
@JamesNK
Copy link
Member

JamesNK commented Jul 30, 2025

/backport to release/9.4

@github-actions
Copy link
Contributor

Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16610455225

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

4 participants