Skip to content

Fix commands left in a disabled state#9383

Merged
danmoseley merged 3 commits intomainfrom
jamesnk/command-disable-fix
May 20, 2025
Merged

Fix commands left in a disabled state#9383
danmoseley merged 3 commits intomainfrom
jamesnk/command-disable-fix

Conversation

@JamesNK
Copy link
Copy Markdown
Member

@JamesNK JamesNK commented May 19, 2025

Description

I think this issue is caused by UI state not updating because of the delay. Fix is to switch to using EventCallback rather than func. EventCallback will always update state after it has finished running.

Fixes #8815

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?

Copy link
Copy Markdown
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

Swaps Func<Task> parameters for Blazor EventCallback to ensure UI state refreshes after callbacks complete.

  • Changed AddMenuItems signatures and invocations to use EventCallback<T> and InvokeAsync.
  • Updated callers in Razor components to create EventCallback via EventCallback.Factory.
  • Adjusted unit tests to supply EventCallback.Empty.

Reviewed Changes

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

Show a summary per file
File Description
tests/.../ResourceMenuItemsTests.cs Replaced dummy Func<Task> args with EventCallback.Empty.
src/.../Model/ResourceMenuItems.cs Changed parameters to EventCallback<T> and updated OnClick.
src/.../Resources.razor.cs Created callbacks with EventCallback.Factory.Create<...>.
src/.../ConsoleLogs.razor.cs Wrapped navigation lambda into EventCallback.
src/.../ResourceActions.razor.cs Passed EventCallback props directly instead of .InvokeAsync.

Comment thread src/Aspire.Dashboard/Model/ResourceMenuItems.cs Outdated
Comment thread src/Aspire.Dashboard/Model/ResourceMenuItems.cs
@danmoseley
Copy link
Copy Markdown
Member

ignore markdownlint

@JamesNK JamesNK force-pushed the jamesnk/command-disable-fix branch from 8a99231 to 5f672c3 Compare May 20, 2025 02:17
@danmoseley danmoseley requested a review from adamint May 20, 2025 20:18
@danmoseley danmoseley merged commit e8e65fd into main May 20, 2025
254 checks passed
@danmoseley danmoseley deleted the jamesnk/command-disable-fix branch May 20, 2025 20:29
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WebToolsE2E][Aspire] The restart button is disabled after restarting the project for web app project with Aspire 9.3.

4 participants