Open PolyCement opened 5 months ago
Hi. It is undocumented because it should be internal and not supposed to be used. This is the way to use this lib in forms: https://github.com/mathieuprog/polymorphic_embed?tab=readme-ov-file#displaying-form-inputs-and-errors-in-liveview
Could you compare that to your code and let me know?
Sorry, I didn't realise they were intended for internal use only!
I'm using a virtual field of the parent to set the embed type via a select, and the new polymorphic_embed_inputs_for
component in the example you linked doesn't seem to have a type
attribute that would let me use it in the same way. Using PolymorphicEmbed.HTML.Form.polymorphic_embed_inputs_for/4
as below seems to work just fine though:
polymorphic_embed_inputs_for @form, :config, input_value(@form, :type), fn config_form ->
However, to_form
is also available from the Form
module. Maybe the docs could state which functions are meant to be for internal use only? Either way, thanks for the help!
Hi, I just ran into an unexpected compilation error while updating to the latest version:
From the docs it seems that between v3.0.7 and v4.0.0 (specifically, in commit 7fc853b) the
type
argument was dropped, which isn't documented in the changelog. Not a huge deal as that commit also adds a newpolymorphic_type
option, so changing the call as follows got it compiling again:However, since both the breaking change and the options for
to_form/4
are undocumented, it took some rummaging around in the repo to figure out. Maybe it'd be good to mention it in the changelog so no one else gets stumped by it like I did?(Glad to see this project is still active btw!)