Skip to content

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

Open
jonklein wants to merge 1 commit intophoenixframework:mainfrom
jonklein:main
Open

Force assign ID on LiveComponents to re-render during :phoenix_live_reload#3320
jonklein wants to merge 1 commit intophoenixframework:mainfrom
jonklein:main

Conversation

@jonklein
Copy link
Copy Markdown

Live reloading does not currently work with live_components, as described in phoenixframework/phoenix_live_reload#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.

@SteffenDE SteffenDE requested a review from chrismccord July 27, 2024 10:10
@josevalim
Copy link
Copy Markdown
Member

FWIW, I have been talking to @chrismccord about supporting a new strategy which is basically rebuilding the page but without doing a full navigation. Regarding the patch above, I think it will call the update callback, which we probably don't want to? We probably need to change the Diff module and simply ask them to be re-rendered again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants