chrismccord

chrismccord

Creator of Phoenix

Phoenix LiveView 1.0.0-rc.0 is out!

LiveView 1.0.0-rc.0 is out!

This 1.0 milestone comes almost six years after the first LiveView commit. I published a Phoenix blog highlighting our developments along the way, a few fun demos, and what we’re up to next.

Existing applications on 0.20.x should have a quick upgrade. We have one backwards compatible change that you can add back via a phx-feedback-for shim. Full changelog with shim notes:

Changelog

Backwards incompatible changes for 1.0

LiveView 1.0 removes the client-based phx-feedback-for annotation for showing and hiding input feedback, such as validation errors. This has been replaced by Phoenix.Component.used_input?/2, which handles showing and hiding feedback using standard server rendering.

A backwards-compatible shim can be used to maintain phx-feedback-for in your existing applications:

  1. Save the phx_feedback_dom.js shim to your local assets/js/phx_feedback_dom.js.
  2. Import it into your assets/js/app.js.
  3. Add a new dom option to your LiveSocket constructor, or wrap the existing value:
import {Socket} from "phoenix";
import {LiveSocket} from "phoenix_live_view"
import phxFeedbackDom from "./phx_feedback_dom"

let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content");
let liveSocket = new LiveSocket("/live", Socket, {
  params: {_csrf_token: csrfToken},
  dom: phxFeedbackDom({})
})

1.0.0-rc.0 :rocket: (2024-05-08)

Backwards incompatible changes

  • Remove phx-feedback-for in favor of Phoenix.Component.used_input?. See the changelog for a backwards compatible phx-feedback-for shim to add to existing applications.

Removal of previously deprecated functionality

  • live_component/2 and live_component/3 helpers (not the function component) have been removed

Bug fixes

  • Fix attributes of existing stream items not being updated on reset
  • Fix nested LiveView within streams becoming empty when reset
  • Fix phx-mounted firing twice, first on dead render, then on live render, leading to errors when a LiveComponent has not yet mounted
  • Fix JS.toggle_class error when used with a transition

Enhancements

  • Warn on mismatched client and server versions

Happy hacking!
–Chris

Most Liked

DevotionGeo

DevotionGeo

That’s fantastic news! Huge congratulations and thanks :pray: to Chris McCord (@chrismccord) and the team for reaching this milestone.

This is a major achievement for the Elixir community!

It would be great to hear from course creators and book authors about when their Phoenix LiveView content will be updated for version 1.0.0. This will ensure new developers jumping into LiveView.

Here’s a quick rundown of some key content creators:

Hopefully, they can chime in and share their update timelines!


Feel free to edit, add more learning material, and mention their authors.

chrismccord

chrismccord

Creator of Phoenix

no, not something we’ll ever ship :slight_smile:

The whole promise of LiveView is you can add “realtime” the moment you need it, without suddenly rewriting everything and brining all this complexity. If you want good interactions with the backend, LiveView is the best choice from latency and overhead perspectives. With The LiveWire approach, you’ll have more load on the server because you’re hitting the database more frequently, doing TLS more frequently, etc. Payloads will be much larger. The only argument is memory footprint, of which the 1.0 blog outlines how a 1GB server has a theoretical max of 25k concurrent users, so even with real app workflows, many thousands of concurrent LiveView users would be no problem on small servers. As LostKonbrakai said, we have longpoll as well, with auto longpoll fallback if websockets fail, so websockets themselves also should not be a concern.

Nicodemus

Nicodemus

Awesome news! I’ve been wondering, is :phoenix_live_view going to be merged into the :phoenix hex package? It seems like this has been the plan since :phoenix_live_view contains Phoenix.Component. I know for newbies it’s very confusing why they have to go to :phoenix_live_view on hexdocs to find the documentation for function components that they’re using in layouts and non-live views. Maybe a Phoenix 2.0 release that bundles it all together? Or at least moves Phoenix.Component into :phoenix?

13
Post #9
Pal

Pal

This is great news for Bruce & Sophie :slight_smile:

acangiano

acangiano

Fantastic news!

If you are a beginner and you’d like to try this out, follow these instructions:

  1. Generate a Phoenix project without the live dashboard (as it currently breaks dependencies):

    mix phx.new your_project --no-dashboard

  2. Edit mix.exs within your project and replace the line containing :phoenix_live_view with:

    {:phoenix_live_view, "~> 1.0.0-rc.0"},

  3. Run mix deps.get

  4. Go ahead and create your database, generate live views, migrate, etc.

Where Next?

Popular in Phoenix News Top

chrismccord
LiveView 1.0.0-rc.0 is out! This 1.0 milestone comes almost six years after the first LiveView commit. I published a Phoenix blog highli...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
New
chrismccord
I’m pleased to announce the first release candidate of Phoenix 1.6.0 has landed on the heels of a fresh LiveView 0.16 release! This relea...
New
josevalim
We were notified by Panagiotis Nezis that certain payloads could take a long time to process when converted to integers. New Erlang/OTP v...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
chrismccord
Announcement post dup’d here for convenience: Phoenix 1.7.2 is out! This minor release includes a couple features worth talking about. ...
New
chrismccord
Phoenix 1.3.5, 1.4.18, 1.5.14, and 1.6.14 have been released to resolve a vulnerability in wildcard check_origin configurations. Previou...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
chrismccord
You can read the announcement on the blog, but I’ll dup most of it here for discussion purposes: ––––––––––––––––––––––––––––––––––––––...
451 13182 109
New

Other popular topics Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement