Is the feature request related to a problem? Please elaborate.
I have a method I want to test that triggers a re-render via StateHasChanged, and also returns a value. Due to the re-render, I need to call this inside cut.InvokeAsync, which doesn't provide a way to access the return value.
The suggested solution
Add new overloads for InvokeAsync that return the value returned by workItem. E.g.:
public static Task<T> InvokeAsync<T>(this IRenderedFragmentBase renderedFragment, Func<T> workItem)
public static Task<T> InvokeAsync<T>(this IRenderedFragmentBase renderedFragment, Func<Task<T>> workItem)
Conveniently, these don't need any changes to the method body, since Dispatcher already has the necessary overloads.
This might cause some existing code to start depending on the new overloads, but as far as I can tell there wouldn't be any breaking changes due to this.
Describe any alternative solutions
None that I can think of.
Additional context
n/a
Is the feature request related to a problem? Please elaborate.
I have a method I want to test that triggers a re-render via
StateHasChanged, and also returns a value. Due to the re-render, I need to call this insidecut.InvokeAsync, which doesn't provide a way to access the return value.The suggested solution
Add new overloads for
InvokeAsyncthat return the value returned byworkItem. E.g.:Conveniently, these don't need any changes to the method body, since
Dispatcheralready has the necessary overloads.This might cause some existing code to start depending on the new overloads, but as far as I can tell there wouldn't be any breaking changes due to this.
Describe any alternative solutions
None that I can think of.
Additional context
n/a