Skip to content

associate OnClick to a task made the component wait for the task is finish to close itself #145

Open
@julienGrd

Description

@julienGrd

Hello, i notice when i associate the OnClick to an async Task, the component wil disappear only when the task is finish, which make a very strange behavior to the user.

for example

<ContextMenuTrigger MenuId="indexMenu">
    <p>Right-click on this text to show a basic context menu sample</p>
</ContextMenuTrigger>

<ContextMenu Id="indexMenu">
    <Item OnClick="@OnClick">Item 1</Item>
</ContextMenu>

@functions{
    async Task OnClick()
   {
        await Task.Delay(30000);
   }
}

With this example, the context menu will disappear after 30s. The behavior is really strange, we have impression we click on nothing

Fot now the only workaround i have is to not await my event ( OnClick="@(async args => OnClick())" which generate warning in my solution.

There is a way to close it directly on the click ? thanks ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions