Always update resource list in console logs after hidden bool changes#10705
Conversation
There was a problem hiding this comment.
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()andUpdateMenuButtons()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);
|
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. |
|
Let’s mark this as a 9.4.1 candidate |
|
/backport to release/9.4 |
|
Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16610455225 |
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
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate