LiveView Upgrade Issue: undefined function live_component/2

Phoenix LiveView moved some imports around. You do not need to add core_components.ex, or change any conventions in your application to jump on Phoenix 1.7. For LV 0.18, you need to change your code that does import Phoenix.LiveView.Helpers to use Phoenix.Component. Once you do that, Phoenix.Component provides the deprecated form of live_component/2 which your modal function uses. You can later move to the new function components step by step, but to get on 0.18 you should simply be able to change those imports to use Phoenix.Component and continue.

Hi @chrismccord ! I had changed import Phoenix.LiveView.Helpers to import Phoenix.Component. Was that where I went wrong? Was I supposed to *use" Phoenix.Component and not import it?

I think I got past all of the issues. For anyone who ends up in this same state, I did the following:

To get past the deps issue so that i could upgrade to Phoenix 1.7:

  • deleted _build
  • went through each of the deps that said “Update not possible” individually and worked out what needed updating until Phoenix 1.7 could finally be updated
  • did a final mix deps.update --all and got everything working

To get past the live_component issue:

  • replaced “import Phoenix.Component” with “use Phoenix Component”

Thank you @kokolegorille and @chrismccord !

1 Like