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

Support dynamic component generation #27

Open
kjeske opened this issue May 14, 2024 · 0 comments
Open

Support dynamic component generation #27

kjeske opened this issue May 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@kjeske
Copy link
Contributor

kjeske commented May 14, 2024

Make it possible to automatically produce a Hydro component when an event occurs.

Example:

public Task AddPost()
{
    var post = new Post();
    database.Add(post);
    await database.SaveChanges();

    DispatchGlobal(new PostCreated(PostId: post.Id));
}
public class Post : HydroComponent
{
    public Guid PostId { get; set; }
}
<hydro name="Post" generate-on="typeof(PostCreated)" />

When AddPost action is triggered, it dispatches PostCreated event, which causes a new instance of Post component to render (thanks to generate-on) with the properties taken from the event (PostId).

@kjeske kjeske added the enhancement New feature or request label Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant