phoenix_live_view changelog


Welcome to the latest update! We've been hard at work polishing things up and adding some nifty features. Here’s what’s new and improved:

New Features & Improvements

  • Improved Error Handling Docs 📚
    We’ve beefed up the error handling documentation in the server guide, especially for those tricky scenarios like when an organization has only one member. The docs now include detailed code examples and explanations on how LiveView reacts to exceptions during different stages. This should make it easier to handle unexpected errors and understand the best practices for error handling in your server-side development.

  • Form Handling During Uploads 🚀
    We’ve made some cool changes in view.js to dispatch lock/unlock events without locking the form during upload progress. Now, you can selectively unlock specific elements, ensuring smooth transitions and interactions without unnecessary form locking. Your forms will now handle uploads like a breeze!

  • Clarified Stream Insert Limits 🔢
    We've added clarity on setting limits for stream_insert in Phoenix LiveView. Now, when inserting single items, you’ll need to pass the limit as an option to enforce it on the client. We’ve also provided examples to make it easier for you to manage streams effectively.

Bugfixes

  • Incomplete Doctype Error Handling 🛠️
    We’ve squashed the bug related to incomplete doctypes in the Phoenix Live View Tokenizer. Now, if an incomplete doctype is encountered, a syntax error will be raised, providing more informative feedback and making the tokenization process more robust.

Thanks for sticking with us! We hope these updates make your development experience smoother and more enjoyable. 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-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