Skip to content

Add id to filter forms for LiveView form recovery - #190

Merged
sevenseacat merged 1 commit into
sevenseacat:mainfrom
diogomrts:fix/filter-form-id-clean
Jun 17, 2026
Merged

Add id to filter forms for LiveView form recovery#190
sevenseacat merged 1 commit into
sevenseacat:mainfrom
diogomrts:fix/filter-form-id-clean

Conversation

@diogomrts

Copy link
Copy Markdown
Contributor

Problem

The filter control forms in Cinder.FilterManager use phx-change/phx-submit but have no id attribute. LiveView requires form ids to perform form recovery following crashes or disconnects.

Apps that enable the strict LiveView test check:

config :phoenix_live_view, :test_warnings, missing_form_id: :raise

get a runtime error for every Cinder table that renders filters:

Detected a form with phx-change but missing id

Fix

Add an id derived from the existing @table_id assign to both filter forms (the slot-based and default render paths):

  • #{@table_id}-filters for the controls-slot form
  • #{@table_id}-filter-form for the default form

Notes

@table_id is already passed into these render functions and used for child element ids (e.g. #{@table_id}-filter-body), so the new ids are unique per table.

@sevenseacat

Copy link
Copy Markdown
Owner

Nice one, thank you so much for this!

@sevenseacat
sevenseacat merged commit 55f2539 into sevenseacat:main Jun 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants