phoenixframework / phoenix_live_view

Rich, real-time user experiences with server-rendered HTML
https://hex.pm/packages/phoenix_live_view
MIT License
5.99k stars 902 forks source link

Force assign ID on LiveComponents to re-render during :phoenix_live_reload #3320

Open jonklein opened 2 weeks ago

jonklein commented 2 weeks ago

Live reloading does not currently work with live_components, as described in https://github.com/phoenixframework/phoenix_live_reload/issues/162.

This PR adds support for live reloading of live_components by force re-assigning the live component’s ID field when processing the :phoenix_live_reload message.

I’m not familiar enough with the LiveView internals to know if this is the correct approach, but it’s working well for me in testing - please let me know if there’s a better way to accomplish this.