Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all RenderComponent methods and replace them with additional overloads of Render method #1017

Closed
Tracked by #962
egil opened this issue Mar 6, 2023 · 1 comment · Fixed by #1111
Closed
Tracked by #962
Milestone

Comments

@egil
Copy link
Member

egil commented Mar 6, 2023

Let's simplify the "render" API surface to a single method, RenderAsync(). Instead of having RenderComponent() and SetParametersAndRender(), I just want a single method that users can recognize and should be obvious depending on the context. That means:

public class BunitContext // previous TestContext
{
  // ...
 
  public ValueTask<RenderedFragment> RenderAsync(RenderFragment renderFragment);  
  public ValueTask<RenderedFragment> RenderAsync<TComponent>(Action<ComponentParameterCollectionBuilder<TComponent>> builder);
}

public class RenderedFragment
{
  // ...

  // replaces SetParametersAndRender
  public ValueTask RenderAsync(Action<ComponentParameterCollectionBuilder<TComponent>>? builder = null);
}

At the same time, I want to make ComponentParameter internal. There is no good reason for users to use that type or the tuple overload. Just leads to unstable tests, and I should probably just have removed the option before v1, but kept it around for compatibility's sake.

@egil egil mentioned this issue Mar 6, 2023
Closed
18 tasks
@egil egil added this to the 2.0.0 milestone Mar 6, 2023
@egil egil linked a pull request Jun 14, 2023 that will close this issue
@linkdotnet
Copy link
Collaborator

Done by #1111

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants