Summary
The filter/search <form> rendered by Cinder.FilterManager has no id attribute. On phoenix_live_view 1.1+ this triggers the new missing_form_id diagnostic, and more importantly it means LiveView cannot perform form recovery for the filter form after a disconnect or crash.
Versions
cinder 0.15.0 (latest)
phoenix_live_view 1.2.1
Warning
Running any test that mounts a LiveView containing a <Cinder.collection> prints:
warning: Detected a form with phx-change but missing id:
<form phx-change="filter_change" phx-submit="filter_change" phx-target="1"></form>
Without an id, LiveView will not be able to perform form recovery,
for more information see:
https://hexdocs.pm/phoenix_live_view/form-bindings.html#recovery-following-crashes-or-disconnects
Cause
lib/cinder/filter_manager.ex renders the filter form without an id in both branches:
render_filter_controls_with_slot/2 — line 75
render_filter_controls_default/1 — line 110
<form phx-change="filter_change" phx-submit="filter_change" phx-target={@target}>
Suggested fix
@table_id is already in scope in this module (e.g. it's used at line 109 for id={"#{@table_id}-filter-body"}), so the form can derive a stable, unique id from it:
<form id={"#{@table_id}-filter-form"} phx-change="filter_change" phx-submit="filter_change" phx-target={@target}>
Only one of the two branches renders per table, so a single "#{@table_id}-filter-form" scheme stays unique.
Summary
The filter/search
<form>rendered byCinder.FilterManagerhas noidattribute. Onphoenix_live_view1.1+ this triggers the newmissing_form_iddiagnostic, and more importantly it means LiveView cannot perform form recovery for the filter form after a disconnect or crash.Versions
cinder0.15.0 (latest)phoenix_live_view1.2.1Warning
Running any test that mounts a LiveView containing a
<Cinder.collection>prints:Cause
lib/cinder/filter_manager.exrenders the filter form without anidin both branches:render_filter_controls_with_slot/2— line 75render_filter_controls_default/1— line 110Suggested fix
@table_idis already in scope in this module (e.g. it's used at line 109 forid={"#{@table_id}-filter-body"}), so the form can derive a stable, unique id from it:Only one of the two branches renders per table, so a single
"#{@table_id}-filter-form"scheme stays unique.