The Wire · Showcase
LIVE VIEW HOOKS GET THE ELOQUENT TREATMENT
By RepoJournal · Filed · About Elixir & Phoenix
Phoenix Live View is shipping a passel of hook and JS-client fixes today, headlined by new beforeUpdate arguments that hand you more control over a hook's lifespan.
The Live View desk is busy [1]: hooks now receive `fromEl` and `toEl` in `beforeUpdate`, letting you inspect the old and new elements directly. SteffenDE also landed dynamic `phx-hook` attribute updates [2], closing issue #4058, and improved the error message when attributes are defined after an embedded template [3]. Meanwhile, external uploads finally get cancellation notifications , and a page-loading bug where `phx:page-loading-stop` never fired on failed pushes is fixed [4]. Over on Elixir core, Daniel Kukula is optimizing `Macro.classify_atom` [5] with a binary fast path that skips building a charlist, and Ecto got a clean-up of its savepoint usage . This is a developer-experience day: the hook changes in particular will save real debugging time.
One email a day. Unsubscribe in one click.
Keep up with Elixir & Phoenix in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Review the new beforeUpdate args in Live View before your next deploy to leverage element access phoenixframework/phoenix_live_view [plan]
- → Update any code relying on phx-hook that needed a remount; now it can update dynamically phoenixframework/phoenix_live_view [monitor]
- → Add a test for page-loading-stop on failed pushes to verify the fix in your JS client phoenixframework/phoenix_live_view [monitor]
- → Run your suite with the new Macro.classify_atom optimization to catch any regressions elixir-lang/elixir [plan]
References
- [1] pass fromEl and toEl to hook beforeUpdate ↗ phoenixframework/phoenix_live_view
- [2] Allow dynamically updating phx-hook attribute ↗ phoenixframework/phoenix_live_view
- [3] Improve error message when attributes have been defined after an embe… ↗ phoenixframework/phoenix_live_view
- [4] Stop page loading when pushes fail ↗ phoenixframework/phoenix_live_view
- [5] Optimize Macro.classify_atom (#15768) elixir-lang/elixir