phoenix changelog


Here's a summary of the latest updates and improvements:


New feature: Replace phx-feedback-for with used_input?/1 (#5713)

We've streamlined the handling of input components and form validation by swapping out phx-feedback-for for used_input?/1. This change touches multiple files, including file_uploads.md, core_components.ex, and form_component.ex. Now, input fields check if used_input? is true before assigning errors, and the phx-feedback-for attribute is history! This means a more efficient and consistent approach to handling form inputs and error feedback in Phoenix. 🎉

Bugfix: Persist remote_ip during recycling of a conn (#5792)

We've squashed a bug that caused remote_ip to vanish during connection recycling. Now, remote_ip sticks around along with other headers and peer data, ensuring accurate IP address handling. Plus, we added a test to verify this functionality, so your IP info remains rock solid. 🛠️

Improvement: Re-order doc to better match example (#5796)

We reorganized the "Writing a Channels Client" guide to better match the provided example. This update clarifies the structure of messages sent to a Phoenix Channel, emphasizing unique join_reference and message_reference values, and the importance of matching topic_name and event_name. This makes the guide easier to read and follow. 📚

Improvement: Clarify what's optional in phx.new (#5783)

Creating a new Phoenix app just got more customizable! We've clarified which dependencies are optional when running mix phx.new. You can now skip Ecto, Phoenix.HTML, TailwindCSS, Esbuild, and Phoenix.LiveView with specific flags. The documentation has been updated to reflect these changes, making it easier to tailor your Phoenix app to your needs. 🛠️

Bugfix: Fix signed at default value docs

We corrected the default value for the :signed_at option in Phoenix.Token from System.system_time(:second) to System.system_time(:millisecond). This ensures more precise time tracking for tokens. The documentation has been updated to reflect this change. ⏱️

Bugfix: Fix race condition in async test

Addressed a race condition in an async test related to filtering sensitive data in Phoenix.LoggerTest. We made 61 changes to improve the reliability and accuracy of data filtering and logging mechanisms. This includes handling different data structures and ensuring correct log levels based on telemetry configuration. 🐛🔨


Happy coding! 🚀

Included Commits

2024-05-02T13:14:20 See commit

This commit re-orders the documentation in the "Writing a Channels Client" guide to better match the provided example. The changes made include modifying the structure of the message format that a client sends to a Phoenix Channel. The commit clarifies that the join_reference and message_reference values should be unique and chosen by the client, with the join_reference only needing to be sent for a specific event. Additionally, it emphasizes the importance of the topic_name being a known topic for the socket endpoint and the event_name matching the server channel module's handle_in function.

Overall, the commit aims to improve the understanding of how messages are structured and sent to a Phoenix Channel by reordering the documentation and providing clear guidelines for the values that need to be included in a message. By organizing the information in a more logical sequence and highlighting key points such as unique references and matching topic names, the commit enhances the readability and coherence of the guide for writing a Channels Client in Phoenix.

Files changed

  • guides/howto/writing_a_channels_client.md
2024-05-02T13:15:42 See commit

This commit makes a change to persist the remote_ip during the recycling of a connection in Phoenix. The remote_ip is now included in the recycled connection along with other headers and peer data. This change ensures that the remote_ip information is retained and accessible in the recycled connection, allowing for more accurate and consistent handling of IP addresses in Phoenix applications.

Additionally, a test is added to verify that the remote_ip is indeed persisted during the recycling process. The test creates a connection with a specific remote_ip address, recycles the connection, and then asserts that the remote_ip in the recycled connection matches the original address. This test ensures that the remote_ip persistence functionality is working as expected and helps maintain the integrity of the recycling process in Phoenix.

Files changed

  • lib/phoenix/test/conn_test.ex
  • test/phoenix/test/conn_test.exs
2024-05-02T13:28:17 See commit

This commit clarifies the optional dependencies that can be excluded when running mix phx.new to create a new Phoenix application. By default, the command includes dependencies such as Ecto for communicating with a data store, Phoenix.HTML, TailwindCSS, Esbuild for HTML applications, and Phoenix.LiveView for building realtime and interactive web applications. Users can now skip these dependencies by passing specific flags such as --no-ecto, --no-html, --no-assets, and --no-live when running mix phx.new.

Additionally, the commit updates the documentation to reflect these changes, providing users with a clear list of optional dependencies that can be excluded when generating a new Phoenix application. The commit also includes changes to the phx.new task in the installer module to ensure that the exclusion of these dependencies is properly handled when specified by the user. Overall, this update aims to make it easier for developers to customize their Phoenix applications based on their specific requirements.

Files changed

  • guides/introduction/up_and_running.md
  • guides/json_and_apis.md
  • installer/lib/mix/tasks/phx.new.ex
2024-05-02T13:52:23 See commit

This commit addresses a race condition in an async test related to filtering sensitive data in Phoenix.LoggerTest. The changes include modifications to the test file logger_test.exs, with a total of 34 additions and 27 deletions, resulting in 61 changes overall. The adjustments focus on scenarios where values need to be filtered based on specified parameters, such as discarding or keeping certain values. The commit ensures that the filtering process works correctly for different data structures like maps, lists, and structs, while also handling atomic keys appropriately.

Additionally, the commit includes enhancements to logging functionality in the test suite, specifically related to Plug.Telemetry. Various tests are added to verify the logging output for different HTTP requests, ensuring that the log levels are correctly invoked based on the telemetry configuration. Overall, the commit aims to improve the reliability and accuracy of data filtering and logging mechanisms in Phoenix.LoggerTest, addressing the identified race condition and enhancing the test coverage for these functionalities.

Files changed

  • test/phoenix/logger_test.exs
2024-05-02T14:01:27 See commit

This commit fixes the default value for the :signed_at option in the Phoenix.Token module. The default value for :signed_at was previously set to System.system_time(:second), but it has been corrected to System.system_time(:millisecond). This change ensures that the timestamp of the token is set accurately in milliseconds by default. Additionally, the commit includes changes to the documentation to reflect this update, with modifications made to the lib/phoenix/token.ex file.

Overall, this commit addresses an issue with the default value for the timestamp of tokens in the Phoenix framework. By correcting the default value to milliseconds, the accuracy of the timestamp is improved, providing more precise time tracking for tokens generated within the Phoenix framework. Additionally, the documentation has been updated to reflect this change, ensuring that users are informed of the correct default value for the :signed_at option.

Files changed

  • lib/phoenix/token.ex
2024-05-03T17:20:34 See commit

This commit replaces the use of phx-feedback-for with used_input?/1 in the Phoenix framework. The changes include modifying the file_uploads.md guide, removing phx-feedback-for from the default input component in core_components.ex, and updating versions in various mix.exs files. The core_components.ex file now checks if used_input? is true before assigning errors to the input field, and the HTML structure for input components no longer includes phx-feedback-for attribute. Additionally, the form_component.ex file has been modified to use the new approach for assigning forms and handling events related to validation and saving data.

Overall, this commit streamlines the handling of input components and form validation in Phoenix by replacing phx-feedback-for with used_input?/1. It updates multiple files to reflect this change, ensuring a more efficient and consistent approach to handling form inputs and error feedback in the framework.

Files changed

  • guides/howto/file_uploads.md
  • installer/templates/phx_assets/tailwind.config.js
  • installer/templates/phx_single/mix.exs
  • installer/templates/phx_umbrella/apps/app_name_web/mix.exs
  • installer/templates/phx_web/components/core_components.ex
  • priv/templates/phx.gen.live/form_component.ex