AE
Ash Elixir•3y ago
dblack

`form_for` deprecation warning when using FilterForm

I'm getting a deprecation warning filling up the terminal (I'll blame that for the earlier inspect non-issue!):
warning: form_for/3 without an anonymous function is deprecated. If you are using Phoenix.LiveView, use the new Phoenix.Component.form/1 component
(phoenix_html 3.3.1) lib/phoenix_html/form.ex:341: Phoenix.HTML.Form.form_for/3
(elixir 1.14.3) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(phoenix_live_view 0.18.18) lib/phoenix_component.ex:2266: Phoenix.Component."inputs_for (overridable 1)"/1
(phoenix_live_view 0.18.18) lib/phoenix_live_view/tag_engine.ex:68: Phoenix.LiveView.TagEngine.component/3
(my_app 0.1.0) lib/my_app_web/live/filter_form_live.ex:65: anonymous fn/2 in MyAppWeb.FilterFormLive.filter_form_component/1
(phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:517: Phoenix.LiveView.Diff.invoke_dynamic/2
(phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:398: Phoenix.LiveView.Diff.traverse/7
(phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:544: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/7
...
warning: form_for/3 without an anonymous function is deprecated. If you are using Phoenix.LiveView, use the new Phoenix.Component.form/1 component
(phoenix_html 3.3.1) lib/phoenix_html/form.ex:341: Phoenix.HTML.Form.form_for/3
(elixir 1.14.3) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(phoenix_live_view 0.18.18) lib/phoenix_component.ex:2266: Phoenix.Component."inputs_for (overridable 1)"/1
(phoenix_live_view 0.18.18) lib/phoenix_live_view/tag_engine.ex:68: Phoenix.LiveView.TagEngine.component/3
(my_app 0.1.0) lib/my_app_web/live/filter_form_live.ex:65: anonymous fn/2 in MyAppWeb.FilterFormLive.filter_form_component/1
(phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:517: Phoenix.LiveView.Diff.invoke_dynamic/2
(phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:398: Phoenix.LiveView.Diff.traverse/7
(phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:544: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/7
...
Line 65 of my component is the call to <.inputs_for :let={components} field={@component[:components]}>... I think the warning is referring to the call to form_for at https://github.com/ash-project/ash_phoenix/blob/main/lib/ash_phoenix/filter_form/filter_form.ex#L948 but not totally sure
6 Replies
ZachDaniel
ZachDaniel•3y ago
🤔 oh, yeah you're right I think that just needs to be calling to_form not form_for
dblack
dblackOP•3y ago
ah, ok, let me try
ZachDaniel
ZachDaniel•3y ago
At the line you pointed out in ash_phoenix source
dblack
dblackOP•3y ago
passing everything else through as opts to to_form/2?
ZachDaniel
ZachDaniel•3y ago
I think so...will be able to look into it a bit more later
dblack
dblackOP•3y ago
no worries, I'll have a poke around. If i get stuck i'll stick up an issue on gh

Did you find this page helpful?