Skip to content

Support async delegates for WaitFor* #1822

Description

@radmorecameron

Is the feature request related to a problem? Please elaborate.

Yes, some of our state checking logic involves invoking an async method.

** A clear and concise description of what the problem is. **
WaitForStateAsync (and all other WaitFor*Asyncs) don't support async lambdas.

The suggested solution

Allow passing a Func<bool, Task> so async lambda can be used.

Additional Context
Minimum repro:

var myCut = RenderComponent<MyComponent>();
await myCut .WaitForStateAsync(async () => {
    return await myCut .CheckStateAsync();
});

// MyComponent

<div>
</div>
@code {
   public async Task<boolean> CheckStateAsync() {
     // async state checking code
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions