Closed ftes closed 3 months ago
This PR does sound like a good idea to me. I tried supporting multiple inputs with ending with []
using DeepMerge, and being able to also uncheck a checkbox from a group made the whole thing super complex. I tried backporting the tests from my branch on yours and they don't go through, but I guess I'll be able to get it to work on top.
Fixes #77 Replaces #79, #90, #93
Goal
Ensure same form handling semantics as Phoenix controllers and LiveView.
Details
Track form data as a flat list of
{name, value}
tuples. This can be read straight from the DOM and needs no further conversions. Example:Defer transforming that flat list into a nested data structure: When submitting form or evaluating other LiveLive
phx-*
callbacks.Use Plug.Conn.Query.decode/4 to transform flat list into nested data structure. Reason: Phoenix Controllers and LiveView do the same (see https://github.com/germsvel/phoenix_test/issues/77#issuecomment-2123962071).