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

Allow components without ChildContent to be added to RenderTree #1179

Open
egil opened this issue Aug 15, 2023 · 2 comments
Open

Allow components without ChildContent to be added to RenderTree #1179

egil opened this issue Aug 15, 2023 · 2 comments
Labels
enhancement New feature or request needs design More design is needed before this issue should result in a feature being implemented.
Milestone

Comments

@egil
Copy link
Member

egil commented Aug 15, 2023

Users sometimes need to add mandatory components into the render tree that does not have a ChildContent parameter.

The RenderTree currently only allows adding components that has a ChildContent property, but that is an arbitrary limitation we can work around.

Now, if you call RenderTree.Add, the component is added as a child of the previous component.

However, I see no downside in allowing RenderFragments in general to be added to the render tree.

IFF a component with a ChildContent is added, then any other components or fragments will be added as children under that. If not, they are added at the root.

There are probably some edge cases I haven't thought about, so lets discuss first.

@egil egil added needs design More design is needed before this issue should result in a feature being implemented. enhancement New feature or request labels Aug 15, 2023
@egil egil added this to the 2.0.0 milestone Aug 15, 2023
@linkdotnet
Copy link
Collaborator

In general, I am on your side, the only open question for me is this:

Users sometimes need to add mandatory components into the render tree that does not have a ChildContent parameter.

This seems more related to 3rd party components, where creating stubs might be the better approach. Or do you have an example at hand?

@egil
Copy link
Member Author

egil commented Aug 15, 2023

It's a pattern I saw in some test code. I think the component being added was a popup content placeholder which was accessed via the services collection by child components.

And yes, more likely in scenarios that involves 3rd party components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs design More design is needed before this issue should result in a feature being implemented.
Projects
None yet
Development

No branches or pull requests

2 participants