Skip to content

Add args fromEl & toEl on beforeUpdate hook#4034

Closed
suciptoid wants to merge 3 commits intophoenixframework:mainfrom
suciptoid:hook-beforeupdate
Closed

Add args fromEl & toEl on beforeUpdate hook#4034
suciptoid wants to merge 3 commits intophoenixframework:mainfrom
suciptoid:hook-beforeupdate

Conversation

@suciptoid
Copy link
Copy Markdown

This PR adds support for a beforeUpdate(fromEl, toEl) function on client hooks, allowing hooks to handle DOM update logic similarly to the global LiveSocket option dom.onBeforeElUpdated(from, to).

Until now, intercepting DOM updates before patching was only possible through the global dom.onBeforeElUpdated callback. This PR extends that behavior to hooks, allowing them to handle pre-update logic locally during LiveView DOM diffs.

@SteffenDE
Copy link
Copy Markdown
Collaborator

Duplicate of #3616, but it's good to have a test included!

@suciptoid
Copy link
Copy Markdown
Author

My bad for searching the existing PR in the wrong repo (phoenixframework/phoenix). Thanks for pointing it out!

@suciptoid suciptoid closed this Oct 31, 2025
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