We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
phoenix_live_view changelog
Hey there, awesome devs! We've got some exciting updates and fixes for you. Let's dive into what's new and improved! 🚀
New Feature: Simplified Live Sessions
We've removed the version field from live_session
to make your life easier. Previously, this version field caused LiveViews to fully reload after a deployment, losing state and breaking form recovery. Now, by relying solely on the live_session
name for security, your LiveViews will smoothly handle updates without unnecessary reloads. This change keeps things simple and efficient, ensuring your sensitive routes stay protected with on_mount hooks. 🎉
Bugfix: Curly Interpolation in Style/Script Tags
No more curly interpolation mishaps in your <style>
and <script>
tags! We've fixed an issue where the phx-no-curly-interpolation
attribute was disabling curly interpolation for all elements indiscriminately. Now, it smartly skips disabling interpolation for these tags, so your scripts and styles behave just as you intend. 🛠️
Thanks for being part of our community! Keep building awesome stuff and enjoy the smoother, more reliable LiveView experience. Happy coding! 💻✨
Included Commits
The commit addresses an issue related to the handling of curly interpolation in the Phoenix LiveView framework, specifically within <script>
and <style>
tags. Previously, the phx-no-curly-interpolation
attribute would disable curly interpolation for all elements, but this change ensures that it only applies to elements that are not of the script
or style
type. The modification enhances the tokenizer logic by adding a condition to check if the current element is a script or style tag before disabling curly interpolation, thereby preserving the intended behavior of these tags.
Additionally, the commit includes updates to the test suite to verify that the new behavior works as expected. New test cases have been added to confirm that curly interpolation is correctly ignored within <style>
tags while still functioning for other elements with the phx-no-curly-interpolation
attribute. The changes help close issue #3714, ensuring that the framework's rendering behavior is both predictable and aligned with developer expectations.
Files changed
- lib/phoenix_live_view/tokenizer.ex
- test/phoenix_live_view/html_engine_test.exs
The commit titled "Remove version from live_session" addresses an issue with the live_session component in the Phoenix LiveView framework. Previously, the live_session included a version field that was randomly generated during router compilation. This versioning was used to enforce full redirects during live navigations, particularly after deployments that altered the router. However, it was discovered that this mechanism led to unintended behavior where LiveViews mounted through a live navigation did not remount after updates, resulting in the loss of state and hindering form recovery functionality.
The decision to remove the version field stems from the realization that the primary security mechanism relies on the live_session name alone, which is sufficient for authorization checks. This change simplifies the implementation by eliminating the unnecessary versioning that caused complications, thereby ensuring that LiveViews can properly handle state and navigation during updates without the risk of unauthorized access to sensitive routes. The commit includes modifications across several files, removing references to the version field and adjusting related logic to maintain functionality.
Files changed
- lib/phoenix_live_view/channel.ex
- lib/phoenix_live_view/router.ex
- lib/phoenix_live_view/session.ex
- lib/phoenix_live_view/static.ex
- test/phoenix_live_view/router_test.exs