Hey there, I’m playing with Ash and TypedStructs. I defined an update action on a resource which takes a TypedStruct as argunent:
With SessionsByInterval being the TypedStruct:
update :set_sessions do
argument :sessions, SessionsByInterval, allow_nil?: false
end
Now in LiveView, I’d like to create a form for this action. How do I render this form? If I use <.inputs_for on @form[:sessions], I get a AshPhoenix.Form.NoFormConfigured.
Ah, yeah so that logic for nested forms currently only works for embedded resources, not for simple map types like that. We’d need to add support for that in AshPhoenix.
Which really isn’t ideal. We could add this to AshPhoenix but its not super trivial, so converting your TypedStruct into embedded resources is probably the best way to go for now.
Thanks a lot for the fast reply.
Yeah at some point I figured it might not be doable/simple. In my case it was easiest to just ditch the TypedStruct and make its fields separate args to the action.