Fork me on GitHub

The relevant docs are here But this picker example doesn’t include what to do when picking nothing is a valid value or when the list of preexisting is empty. The whole thing seems to malfunction and start referencing ident [:ident nil] .


Solved it by setting inital state of parent to nil


I think the picker can also be told it is clearable. That said, the whole system is easily pluggable, so you can augment the state machine, change the implementation of the control, etc. It is possible you uncovered a bug with a workaround, since the built in picker should not set the value to a bad ident. I may have released an initial state improvement recently that broke that for that case


I think the cause is that when form/create! is called, a full initial state tree is initialized, including subform, and the system considers a to-one ref to parent a subform automatically, so it initializes it with nil data, which normalizes to [category/id nil]. By setting initial state option to nil by: `

(form/create! app-ish CategoryForm {:initial-state {::m.category/parent nil}})
I;ve managed to force it to initialize without a parent link


The parent picker is empty list when no categories have been created yet


The picker problem I addressed with:

(cons {:text "None" :value nil}
      (map (fn [{::m.category/keys [id title]}]
           {:text title :value [::m.category/id id]})


so I’ve added an explicit none value at the top


Ok my workaround prompts a bunch of errors.

Subforms for class roklenarcic.ui.category/CategoryForm must include a ::form/ui entry for Object

 Subform class null must include a ::form/id that is an attr/attribute

Subform not declared (or is missing ::form/id) for Object on roklenarcic.ui.category/CategoryForm


Are you using the latest version? If so, try backing off a few steps and see if that works. I did an initial ui props fix recently that could be causing the problem. I’m not sure it should, but it might


you could also try this fix, GIT commit SHA 6eeb448896b5f15e7aaa87aa19f05ff747b74e0d in deps for fulcro-rad


If that fixes it, then I’ll push a new version


Is it possible to tell form to add the item to some list in the state after a new item is successfully saved?


You have save middleware if you need to augment the same as it happens on the server, and triggers on the form itself if it is a UI concern.


interesting… I haven’t really noticed client-side form middleware


Mainly I lack an easy strategy of updating pickers and lists of entities when adding entities.


So there is not client side middleware, just the state machine. However, the server side middleware can modify things and because the complete form state is returned from the save mutation, it can have the visible effect of changing what's on screen after the save.