Open leandrocp opened 2 weeks ago
Could there be a separate CRUD for adding live components as well? It would be great to have the ability to add them without needing to restart the app.
Could there be a separate CRUD for adding live components as well? It would be great to have the ability to add them without needing to restart the app.
Hey @absowoot do you mean creating a https://hexdocs.pm/phoenix_live_view/Phoenix.LiveComponent.html? That's possible although it's not on the roadmap yet. First we're getting functions components so you can define attrs, slots, etc to use on page template, ie: a component named my_header
is available on the template as <.my_header attrs...>
- the last task to get this done is the admin interface https://github.com/BeaconCMS/beacon_live_admin/pull/160
After getting that done we would have the foundation to work on LiveComponents too. Feel free to open an issue requesting support for LiveComponents so we can have it on the backlog.
A common scenario that's not yet handled fully by Beacon is handling events emitted by components. Suppose a
newsletter_form
component that renders a form withphx-submit="signup"
, thatsignup
event will be handled by an event handler defined in the Page, that works and is the current approach we have.But it becomes cumbersome when that component is called in a layout because now all pages using that layout must create the same event handler over and over again, duplicating data and effort to manage that event.
See how the event_handler
signup
gets duplicated.The proposal is to introduce a *(Event Handlers** resource in the Content API and also on the Admin interface to manage shared events so whenever an event is called, it will be fetched by name and executed, globally on the site.
Tasks
beacon_event_handlers
table and schemaBeacon.Content
that will be called from BeaconLiveAdminFAQ