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! Here's the latest scoop on the updates we've been working on. We've focused on making things faster, tidier, and more understandable. Check out the highlights below! 🚀
-
Improvement in Form Serialization: We've turbocharged the
serializeForm
function! 🏎️💨 It now zooms through large forms with ease, avoiding unnecessary work and complexity. The new streamlined approach means less waiting time and fewer browser hang-ups when dealing with hefty forms. Plus, we've tidied up the code with some linting and improved the way input names are handled. -
Asset Updates: Our assets got a makeover! 🎨 The JavaScript files have been updated, focusing on smarter logic to track form inputs. This means a more efficient way of identifying which inputs are unused or hidden, resulting in a smoother and faster experience.
-
Documentation Boost for put_flash: We've polished up the docs for
put_flash
. 📝✨ Now, it's easier to understand how flash messages work, their lifespan, and their behavior during navigation. Plus, we've highlighted best practices to ensure only user-friendly notifications are included. -
Chore: E2E Test Warnings: We tidied up the end-to-end test warnings. 🧹 No more pesky alerts during test runs! By removing unused aliases and optimizing the code, we've made the testing process cleaner and more enjoyable.
Hope you enjoy the improvements! 😊
Included Commits
This commit enhances the documentation for the put_flash
function in the Phoenix.LiveView
module. Key improvements include clarifying how flash messages persist until read and detailing their behavior during redirects or navigation events, where they are signed and temporarily stored on the client side. The documentation emphasizes that flash messages should only contain user-facing notifications and should not include sensitive information.
Additionally, the updated documentation specifies that in a typical LiveView application, flash messages are rendered using the CoreComponents’ flash/1
component, which supports default message types such as :info
and :error
. The changes also reiterate that put_flash/3
can be used within Phoenix.LiveComponent
and explains how the @flash
assign in components interacts with the parent LiveView. Overall, the commit aims to provide clearer guidance on the use and limitations of flash messages in LiveView applications.
Files changed
- lib/phoenix_live_view.ex
The commit titled "Optimize serializeForm" focuses on improving the efficiency of the serializeForm
function in the phoenix_live_view
library, particularly addressing performance issues that arise with larger forms. The existing implementation was found to perform unnecessary operations, leading to increased complexity and potential timeouts in JavaScript, especially when handling medium-sized forms. The optimization involves reducing redundant calculations by leveraging a more streamlined approach to track input states and their usage, which ultimately enhances performance and reduces the likelihood of browser hangs.
Key changes include the replacement of the method for identifying unused and hidden inputs by utilizing a single pass through the form elements, which eliminates the need for multiple filtering operations. This not only simplifies the code but also cuts down on processing time. The commit also includes minor linting adjustments and updates to the way input names are referenced, further contributing to the overall efficiency of the serializeForm
function.
Files changed
- assets/js/phoenix_live_view/view.js
This commit involves updates to several JavaScript files related to the Phoenix LiveView framework, specifically improving the serializeForm
function. The changes primarily focus on enhancing the logic for determining which form inputs are unused or hidden. The new implementation utilizes a reduced structure that collects information about input elements, allowing for a more efficient assessment of their usage status. This includes checking if inputs have been focused or submitted, and whether they are of the hidden type, thereby refining how unused inputs are identified and managed.
Additionally, the commit modifies the associated source maps and minified files, ensuring that the updates are reflected across all relevant assets. Overall, these changes aim to optimize form serialization by providing a clearer distinction between used and unused inputs, which can enhance performance and reliability in handling form data within the framework.
Files changed
- priv/static/phoenix_live_view.cjs.js
- priv/static/phoenix_live_view.cjs.js.map
- priv/static/phoenix_live_view.esm.js
- priv/static/phoenix_live_view.esm.js.map
- priv/static/phoenix_live_view.js
- priv/static/phoenix_live_view.min.js
This commit primarily addresses warnings encountered during the execution of end-to-end (e2e) tests in a Phoenix LiveView application. It modifies multiple files in the test/e2e/support
directory to eliminate unnecessary warnings, particularly by removing unused aliases and implementing a compilation directive to suppress warnings related to undefined hooks. Notably, the Phoenix.LiveViewTest.E2E.Hooks
module is now explicitly marked to avoid warnings, enhancing the clarity and maintainability of the code.
In addition to these changes, several instances of unused aliases for Phoenix.LiveView.JS
were removed across various test files, streamlining the code and reducing clutter. The commit also includes minor adjustments to function parameters in event handlers to reflect the fact that the parameters are not utilized, thereby improving code readability. Overall, these modifications contribute to a cleaner codebase and a smoother testing experience by minimizing warning messages.
Files changed
- test/e2e/support/form_live.ex
- test/e2e/support/issues/issue_3496.ex
- test/e2e/support/issues/issue_3529.ex
- test/e2e/support/issues/issue_3656.ex
- test/e2e/support/issues/issue_3658.ex
- test/e2e/support/issues/issue_3681.ex
- test/e2e/support/issues/issue_3684.ex
- test/e2e/support/navigation.ex