improvement: support latest phoenix

This commit is contained in:
Zach Daniel 2022-09-27 18:34:03 -04:00
parent b088969315
commit 3b56ee5d2c
2 changed files with 12 additions and 3 deletions

View file

@ -589,8 +589,17 @@ defmodule AshPhoenix.LiveView do
defp mark_page_as_first(page), do: page defp mark_page_as_first(page), do: page
defp assign(%Phoenix.LiveView.Socket{} = socket, one, two) do case Code.ensure_compiled(Phoenix.LiveView.Component) do
Phoenix.LiveView.assign(socket, one, two) {:module, _} ->
if function_exported?(Phoenix.LiveView.Component, :assign, 3) do
defp assign(%Phoenix.LiveView.Socket{} = socket, one, two) do
Phoenix.Component.assign(socket, one, two)
end
else
defp assign(%Phoenix.LiveView.Socket{} = socket, one, two) do
Phoenix.LiveView.assign(socket, one, two)
end
end
end end
defp assign(socket, one, two) do defp assign(socket, one, two) do

View file

@ -116,7 +116,7 @@ defmodule AshPhoenix.MixProject do
defp deps do defp deps do
[ [
{:ash, ash_version("~> 2.0.0-rc.9")}, {:ash, ash_version("~> 2.0.0-rc.9")},
{:phoenix, "~> 1.5.6 or ~> 1.6.0"}, {:phoenix, "~> 1.5.6 or ~> 1.6"},
{:phoenix_html, "~> 2.14 or ~> 3.0"}, {:phoenix_html, "~> 2.14 or ~> 3.0"},
{:phoenix_live_view, "~> 0.15"}, {:phoenix_live_view, "~> 0.15"},
{:git_ops, "~> 2.4.4", only: :dev}, {:git_ops, "~> 2.4.4", only: :dev},