phoenix_live_view changelog


Welcome to the latest round-up of updates, improvements, and fixes! Dive in to discover how we've been busy fine-tuning the Phoenix LiveView experience, enhancing performance, and ensuring seamless navigation. Let's get started! 🚀

  • Improvement: We've enhanced the storytelling in the security guide for the server's security model, focusing on live_session in Phoenix LiveView applications. This update clarifies authentication and authorization processes, highlights the importance of the on_mount hook, and provides a better understanding of push_navigate mechanics. 🛡️

  • Improvement: The to_form/2 function has been optimized to require fewer traversals, improving performance and code readability. This includes direct handling of Phoenix.HTML.Form and streamlined option processing. ⚡

  • Bugfix: Addressed an issue related to live sessions when patching to the same LiveView. The fix ensures correct session data usage, enhancing session management integrity within the framework. 🐛

  • Improvement: Updated the CI configuration to run against Elixir's latest version, ensuring compatibility with new features and standards. This change enhances the project's CI pipeline, keeping it on the cutting edge. 🔧

  • Bugfix: Fixed the array destructuring in the cancelSubmit method, resolving unexpected behavior due to incorrect parameter handling. This fix streamlines the method's functionality. 🎯

  • New Feature: Added Fluxon UI to the list of component systems, providing developers with elegant and accessible UI components for Phoenix LiveView. This addition expands the ecosystem of available tools. 🎨

  • Bugfix: Reverted a previous change intended to fix unnecessary remounting when navigating back, indicating a reevaluation of navigation behavior within the framework. This revert ensures a stable user experience. 🔄

Stay tuned for more updates and keep exploring the ever-evolving world of Phoenix LiveView! 🌟

Included Commits

2024-11-16T15:37:51 See commit

This commit updates the CI configuration for a project by modifying the GitHub Actions workflow file (ci.yml). The primary change involves adding a new job to run the CI against the latest version of Elixir (referred to as "main") alongside the existing setup for Elixir 27.0. This addition aims to catch any potential warnings early in the development process, ensuring that the codebase remains compatible with the latest Elixir features and standards.

In the modified workflow, a new matrix entry for Elixir "main" is introduced, which runs alongside the existing jobs. Additionally, the condition for compiling and linting dependencies has been adjusted to include this new Elixir version, allowing for warnings to be treated as errors during the CI process. Overall, these changes enhance the project's CI pipeline by ensuring that it remains up-to-date with the latest Elixir developments.

Files changed

  • .github/workflows/ci.yml
2024-11-17T18:11:00 See commit

The commit optimizes the to_form/2 function in the Phoenix.Component module to reduce the number of traversals required during its execution. This is achieved by restructuring how options are processed and how the data is updated. Specifically, the function now directly handles the case where a Phoenix.HTML.Form is passed in without options, returning the data immediately. Additionally, the handling of options has been streamlined using Enum.reduce, allowing for a more efficient update of the form's properties without unnecessary intermediate steps.

The changes include the removal of redundant tuple assignments and the simplification of the logic that merges options with the existing form data. The overall effect is a cleaner and more efficient implementation that should improve performance when calling to_form/2, particularly in scenarios involving multiple options. The commit maintains the functionality while enhancing code readability and efficiency.

Files changed

  • lib/phoenix_component.ex
2024-11-17T18:55:04 See commit

This commit reverts a previous change made to the Phoenix LiveView framework that aimed to fix unnecessary remounting when navigating back within the application. The reverted commit had removed a line of code responsible for replacing the root history when the main view was active, which was intended to optimize the navigation experience. The revert indicates that the prior fix may have introduced issues or did not work as intended, leading to its removal.

Additionally, the commit modifies the end-to-end test suite by removing a specific test case that verified the functionality of navigating back without remounting. The deleted test was designed to ensure that when users navigated back, the application would only patch the view rather than remount it, confirming that the navigation was seamless. The removal of this test suggests a shift in focus or a reevaluation of the navigation behavior within the framework.

Files changed

  • assets/js/phoenix_live_view/view.js
  • test/e2e/tests/navigation.spec.js
2024-11-18T18:20:06 See commit

This commit adds Fluxon UI to the list of component systems in the project's README.md file. Specifically, it introduces a new entry that highlights Fluxon UI as a source of elegant and accessible UI components designed for use with Phoenix LiveView. The changes include two additions, enhancing the documentation to reflect this new resource for developers.

Overall, the update emphasizes the growing ecosystem of tools available for Phoenix LiveView, providing users with more options for implementing user interfaces that are both functional and visually appealing. The inclusion of Fluxon UI underscores the commitment to accessibility and design quality within the community.

Files changed

  • README.md
2024-11-18T19:51:26 See commit

The recent commit enhances the storytelling aspect of the security guide for the server's security model, specifically focusing on the use of live_session in Phoenix LiveView applications. The modifications include substantial additions and deletions to clarify the authentication and authorization processes, particularly how different user types can be managed through distinct live_session configurations. The guide elaborates on how to implement security checks during the mount callback and emphasizes the importance of encapsulating authentication logic within the on_mount hook, which can be applied at the router level to streamline security for multiple LiveViews.

Additionally, the updated documentation outlines the mechanics of push_navigate within LiveViews and how it interacts with live_session, illustrating how to create boundaries between different user groups while maintaining efficient navigation. By detailing the interplay between regular web requests and LiveViews, the commit aims to provide clearer guidance on implementing robust security measures tailored to specific application needs, thus improving the overall understanding of security practices in the context of Phoenix LiveView.

Files changed

  • guides/server/security-model.md
2024-11-19T16:38:06 See commit

This commit addresses an issue related to live sessions in the Phoenix LiveView framework, specifically when patching to the same LiveView. It modifies the mount_private function in the Phoenix.LiveView.Channel module to ensure that the correct session data is utilized. The changes include merging the socket's session with the verified user session and adjusting how the session information is passed to the mount_private function. This ensures that the LiveView correctly identifies whether it should treat a route as internal or external based on the session version and name.

Additionally, the commit updates the live_link_info! function in the Phoenix.LiveView.Route module to incorporate the session details when determining route classification. The corresponding tests in router_test.exs are also enhanced to validate the expected behavior when patching to the same view with different sessions. This ensures that a patch to the same LiveView fails if it originates from a different session, thus improving the overall integrity of session management within the LiveView framework.

Files changed

  • lib/phoenix_live_view/channel.ex
  • lib/phoenix_live_view/route.ex
  • test/phoenix_live_view/router_test.exs
2024-11-21T08:28:08 See commit

This commit addresses an issue in the cancelSubmit method of the View class in the phoenix_live_view project by fixing the array destructuring in the function's parameter. The change involved modifying the destructuring assignment from [el, ref, _callback] to [el, ref, _opts, _callback], which ensures that the method correctly handles the expected number of parameters when filtering this.formSubmits.

The commit resolves issue #3524 on GitHub, indicating that the previous implementation may have led to unexpected behavior or errors due to incorrect parameter handling. The modification includes two changes in the code, with one line added and one deleted, streamlining the logic within the cancelSubmit method to improve its functionality.

Files changed

  • assets/js/phoenix_live_view/view.js