phoenix_live_view changelog


Welcome to the latest updates! We've been busy squashing bugs, improving documentation, and refining features to make your experience smoother and more efficient. Here’s what’s new:

New feature 🆕

  • Improvements to Error Handling Docs (#3282): We've revamped the error handling section in our server guide! This includes detailed scenarios and code examples on how to handle unexpected errors, like when an organization has only one member. Plus, we've explained how LiveView reacts to exceptions during different stages. This should help you master error handling like a pro!

Bugfix 🐞

  • Raise on Incomplete Doctype (#3055): Fixed an issue where the Phoenix Live View Tokenizer would not handle incomplete doctypes properly. Now, it raises a syntax error, making it easier to debug and ensuring the tokenizer is more robust.

Improvement 🚀

  • Clarify Limit for Stream Insert (#3276): Updated the documentation to specify that the limit must be passed as an option in each call to stream_insert/4. This ensures the limit is enforced on the client side. We’ve also added examples to make it crystal clear how to use this feature.

  • Dispatch Lock/Unlock and Do Not Lock Form on Upload Progress: Enhanced the view.js file to dispatch lock and unlock events without locking the form during upload progress. This ensures smoother user interactions and prevents unnecessary form locking.

Chore 🧹

  • Update Changelog: The changelog has been updated with details on recent enhancements, bug fixes, and backwards incompatible changes. This includes a new warning when rendering an input named "id" and better tracking for checkboxes and hidden inputs.

Stay tuned for more updates and happy coding! 🚀

Included Commits

2024-06-02T20:38:46 See commit

This commit includes improvements to the error handling documentation in the server guide. It addresses scenarios where unexpected errors may occur, such as triggering the "leave" action when an organization has only one member. The code examples provided demonstrate how to handle these situations, including rewriting code to prevent unexpected scenarios and using specific functions to raise exceptions when necessary. Additionally, the commit explains how LiveView reacts to exceptions during different stages, such as HTTP mount, connected mount, and after connected mount, providing insights on how errors are handled in these scenarios.

The changes made in the documentation include clarifications on error handling practices, such as validating organization IDs and user access to resources. It also explains how exceptions are managed in LiveView, highlighting the behavior of the framework when errors occur during different phases of the application. By providing detailed examples and explanations, the commit aims to enhance developers' understanding of error handling mechanisms and best practices within the context of server-side development using LiveView.

Files changed

  • guides/server/error-handling.md
2024-06-05T10:26:25 See commit

This commit addresses issue #3055 by raising an error when an incomplete doctype is encountered in the Phoenix Live View Tokenizer. The changes include modifications to the tokenizer module to handle the unexpected end of the string inside the tag, triggering a syntax error. Additionally, a test case was added to the tokenizer test module to ensure that an incomplete doctype results in the expected ParseError being raised.

Overall, this commit enhances the error handling in the Phoenix Live View Tokenizer by specifically addressing the issue of incomplete doctypes. By raising a syntax error in such cases, the tokenizer module can now provide more informative feedback when encountering this type of issue, ultimately improving the reliability and robustness of the tokenization process.

Files changed

  • lib/phoenix_live_view/tokenizer.ex
  • test/phoenix_live_view/tokenizer_test.exs
2024-06-05T14:16:01 See commit

This commit in the view.js file of the Phoenix Live View project introduces changes that involve dispatching lock and unlock events without locking the form during upload progress. The undoRefs function now includes a parameter onlyEls which allows for selectively unlocking specific elements, preventing the form from being locked by external triggers. Additionally, the commit adds event dispatching for loading states, ensuring that elements are marked as loading during certain events and triggering corresponding custom events for loading and unlocking.

Overall, the changes made in this commit enhance the behavior of form elements during upload progress in the Phoenix Live View project. By allowing for selective unlocking of elements and properly handling loading states, the commit improves the user experience by ensuring smooth transitions and interactions without locking the form unnecessarily.

Files changed

  • assets/js/phoenix_live_view/view.js
2024-05-30T10:06:54 See commit

This commit updates the changelog file, indicating that there have been 4 additions, 1 deletion, and 5 changes made. In the update for version 1.0.0-rc.1, an enhancement was made to warn when rendering an input named "id." Additionally, a bug fix was implemented to correct the used input tracking on checkboxes and hidden inputs. In version 1.0.0-rc.0, there were backwards incompatible changes made, including the removal of phx-feedback-for in favor of Phoenix.Component.used_input?, with a suggestion for a backwards compatible shim to add to existing applications.

Overall, this commit includes updates to the changelog file with details on modifications, additions, and changes made. It also highlights enhancements and bug fixes in version 1.0.0-rc.1, as well as backwards incompatible changes in version 1.0.0-rc.0, providing information on the removal of certain functionality and suggestions for maintaining compatibility in existing applications.

Files changed

  • CHANGELOG.md
2024-05-31T16:09:16 See commit

This commit clarifies the limit for stream_insert in Phoenix LiveView. It specifies that when inserting single items using stream_insert/4, the limit needs to be passed as an option for it to be enforced on the client. This means that the limit set in stream/4 does not affect subsequent calls to stream_insert/4, so the limit must be passed in each call to enforce it. Additionally, the commit provides examples of how to insert, update, and limit items in a stream using stream_insert.

The changes made in this commit include modifications to the Phoenix.LiveView module in the lib/phoenix_live_view.ex file. Specifically, the commit adds 25 lines of code, deletes 8 lines, and changes a total of 33 lines. The patch in the commit includes updates to the stream function to clarify how to limit a stream and how to insert single items with a specified limit. The commit also adds information about the options supported by stream_insert, such as :at for specifying the index to insert or update an item and :limit for setting the limit of items to maintain in the UI.

Files changed

  • lib/phoenix_live_view.ex