Extend attach_hook/4 in LiveComponents

Hey all

Currently, attach_hook/4 in LiveComponents supports only :handle_event and :after_render stages. HexDocs

I’m wondering if it would be possible to support all the rest (like update/2 or handle_async/3) of the LiveComponent lifecycle stages?

Is there a specific reason (technical or design) why LiveComponents are restricted to just those two hook stages?

Thanks!

I don’t think there’s a technical reason blocking it. Adding support for handle_async might be as easy as adding it in line 98 here:

For update, more changes would be necessary, but if you want to look into it, a PR is welcome (I’d probably split it into two separate PRs though!).

1 Like