← All series

Series contents

Log in to track your progress

  1. 1. Simple Phoenix LiveView App: Setup Episode
  2. 2. Simple Phoenix LiveView App: Planning DB Schemas Episode
  3. 3. Simple Phoenix LiveView App: Upgrade to LiveView 0.5.1 Episode
  4. 4. Simple Phoenix LiveView App: Socket Session info, CSRF & .leex Episode
  5. 5. Simple Phoenix LiveView App: Scaffolding Users & Content Episode
  6. 6. Simple Phoenix LiveView App: PubSub & Index Episode
  7. 7. Simple Phoenix LIveView App: Show & Edit Pages Episode
  8. 8. Simple Phoenix LiveView App: Upgrade LiveView to v0.8.1 Episode
  9. 9. Simple Phoenix LiveView App: Fonts, logos and sass Episode
  10. 10. Simple Phoenix LiveView App: Markdown show notes Episode
  11. 11. Simple Phoenix LiveView App: The Podcast Listing Page Episode
  12. 12. Simple Phoenix LiveView App: Upgrade LiveView to v0.12.1 Episode
  13. 13. How I add auth to Phoenix LiveView apps Episode
  14. 14. Simple Phoenix LiveView App: planning comments Episode
  15. 15. Showing comment counts on the index page (Simple Phoenix LiveView App) Episode
  16. 16. Simple Phoenix LiveView app: Embedded comments form Episode
  17. 17. Passing redirect URLs + fragments Episode
  18. 18. Simple Phoenix LiveView App: Series Complete! Episode

Simple Phoenix LiveView App: Upgrade to LiveView 0.5.1

This upgrades our app from Phoenix LiveView from 0.4.0 to 0.5.1, and includes a friendly reminder:

When you follow a tutorial, it's much easier for you if you use the same library versions as in the tutorial to go through the tutorial! Afterwards you'll have more understanding of how everything works and upgrading will be much less painful. In the case of this series, I'll be covering upgrades as we go. In fact, v0.6.0 has just been released and once its docs have caught up with it, we'll be upgrading the app again.

Upgrading to LiveView 0.5.1

First we'll update the version number in mix.exs:

defp deps do
  [
    # ...
    {:phoenix_live_view, "~> 0.5.1"}
  ]
end

Then we'll pull in the new version:

mix deps.get

Running the app now throws an error:

(CompileError) lib/reactor_web/views/layout_view.ex:2: cannot import Phoenix.LiveView.live_render/2 because it is undefined or private

The reason for this error is that live_render/2, along with several other functions were moved into a helpers module in LiveView version 0.5.

Updating web.ex

Fortunately, the fix is simple. Just change this portion of reactor_web.ex from:

import Phoenix.LiveView,
  only: [
    live_render: 2,
    live_render: 3,
    live_link: 1,
    live_link: 2,
    live_component: 2,
    live_component: 3,
    live_component: 4
  ]

to:

import Phoenix.LiveView.Helpers

And everything is up and running again.

Open standalone page ↗

No Comments