tfwright / live_admin

Low-config admin UI for Phoenix apps, built on LiveView
MIT License
260 stars 25 forks source link

Support LiveView 0.18.x #13

Closed dougw-bc closed 1 year ago

dougw-bc commented 2 years ago

I started a PR for this - #12 Might need a version bump that drops support for 0.17.x?

tfwright commented 2 years ago

I noticed you started on that. Very appreciated. It's still in draft mode though, does it need more work or just testing?

It does look like it's not backwards compatible. I will test to make sure, but if not I will definitely want to make it a separate release.

dougw-bc commented 1 year ago

I have synced up my fork + branch, and it's still working on lv 18

Since I am using it with a surface app in an umbrella and surface has to catchup to recent lv releases i have pinned to 0.18.4 for now - but will relax back to 0.18.x when its updated working

I have a few other feature ideas/requests in the meantime!

blutack commented 1 year ago

This branch almost works with Phoenix 1.7 - there is just an issue with missing router helpers as the default config no longer includes them. I've created an issue here: https://github.com/tfwright/live_admin/issues/19

tfwright commented 1 year ago

Main has been updated to use 0.18. If you can, please try it out and let me know if there are any issues.

dantswain commented 1 year ago

Hey there! Just providing more data points here.

I just tried to pull this into an app with Phoenix 1.7 and LiveView 0.18.3 and got

== Compilation error in file lib/live_admin/router.ex ==
** (CompileError) lib/live_admin/router.ex:2: cannot import Phoenix.LiveView.assign/2 because it is undefined or private
    (elixir 1.14.2) src/elixir_import.erl:91: :elixir_import.calculate/6
    (elixir 1.14.2) src/elixir_import.erl:22: :elixir_import.import/4

After switching the dependency to main I get

== Compilation error in file lib/live_admin/view.ex ==
** (CompileError) lib/live_admin/view.ex:4: module Phoenix.View is not loaded and could not be found
    (elixir 1.14.2) expanding macro: Kernel.use/2
    lib/live_admin/view.ex:4: LiveAdmin.View (module)
tfwright commented 1 year ago

Hm I am using main with an app running Phoenix 1.6 and 0.18 and it appears to compile just fine. So it sounds like neither the latest release (0.6) nor main is compatible with Phoenix 1.7? But I would be surprised if that update contains breaking changes. I am only aware of deprecations.

dantswain commented 1 year ago

Looks like you might be useing it? Maybe that macro went away?

This is from the 1.7-rc release notes https://www.phoenixframework.org/blog/phoenix-1.7-released

New applications (and the phx generators), remove Phoenix.View as a dependency in favor of a new Phoenix.Template dependency, which uses function components as the basis for all rendering in the framework.

dantswain commented 1 year ago

Oh! I don't even have phoenix_view as a dependency. My guess is that became an optional dependency in favor of Phoenix.Template? I'll try adding that and see if it works.

dantswain commented 1 year ago

OK manually adding phoenix_view 2.0.2 as a dependency fixes that, but now I'm getting the nil.home_path mentioned in #19. I'm building from main:

* live_admin 0.6.0 (https://github.com/tfwright/live_admin.git) (mix)
  locked at 3692b99
  ok
tfwright commented 1 year ago

@dantswain I opened https://github.com/tfwright/live_admin/issues/20 to eventually remove the use of router helpers, but for now you should be able to use the helpers: true option in your router.

Let me know if you have any other issues.