Fork me on GitHub

I'm getting a FORM NOT NORMALIZED error when submitting a form. It has just a single field, text, and does not have any initial state set in the client code or loaded from the server. My form component has an ident :ident (fn [] [:note-form :singleton]) and its query has a form config join :query [:note/id :note/text #p fs/form-config-join]. Why am I still getting this error?


Also, what is a reconciler? I see mentions of it in the docs but no explanation/definition of it.


@randumbo you using f3? There is no reconciler…it was in f2…I thought I fixed all of those


Ah, musta got my urls mixed up, I was going to which looks outdated. There is just one mention of the reconciler in this example of the proper docs


ooops. that should redirect


I added a redirect…didn’t realize I’d left that there


book was updated yesterday, so the rev date at top should be pretty recent


Got it, ty.


you’re going to need to add initial state to that form..or there is nothing in state for it (it esp isn’t hooked to the data graph)


So just an empty string for the text field should suffice?


Normally you might throw this into your application state with something like:

(merge/merge-component! app PersonForm person-tree)
Where would you put that? I'm not grasping how the form component definition and that part go together. I'm guessing it's not supposed to just go on my mutation helper that saves the person?


Think I'm gonna rewatch the Part 10 : Form Inputs and State video and maybe the ones after it. Maybe it'll clear things up for me.


I'm trying to follow along with Part 11 on form state. I notice that when I apply the same logic (merge-component followed by add-form-config*), my pristine-state does not get populated.

{:note-form {:singleton {:note/id 22, :note/text "Original"}},
 {{:table :note/id, :row 22}
  {:com.fulcrologic.fulcro.algorithms.form-state/id [:note/id 22],
   :com.fulcrologic.fulcro.algorithms.form-state/fields #{:note/text},
   :com.fulcrologic.fulcro.algorithms.form-state/pristine-state {},
   :com.fulcrologic.fulcro.algorithms.form-state/subforms {}}},
    {:table :note/id, :row 22}]}}}
I think it's because I have just a single form with :ident [:note-form :singleton] and I'm trying to create notes from it... but I can't quite understand how to use it properly so it tracks the form state like it's supposed to. Am I abusing the singleton concept here? I only need a single instance of this form, I thought a singleton would be fitting.


object goes in state -> add-form-state adds pristine and form config -> you interact with it (modify the normal entity) -> tell form state you’re done (mark complete) -> form state can calc diffs It’s all View = Function(State), where State is being evolved. Most people struggle I think because they think they’re in some mutable forms library in js or something. This is functional. This uses pure data. Fulcro is always State1 -> render -> state2 -> render … So, you have to create a sequence of states that represent the interaction. Form state is just some helpers that help you do that. And yes, forms are rarely singletons unless the database item is a singleton, so you seem to be abusing the singleton concept as well.


The form should be initialized with a tempid and blank string my case, where the [:note/id tempid] is the form's ident, and then after the form is submitted, the :note/text is set to an empty string and a new tempid is used for the new NoteForm ident, instead of the singleton?


pretty much…there are demos in the book


Yes, I've looked at many of the demos. It's just a lot to infer from when many of the concepts are new. I'm used to Django and Fulcro is a treat to learn, but it's a significant shift. I think I understand my the form mistakes I was making. Going to try to continue on and incorporate UISM.


Thanks for the help. Wish I didn't have to ask as many questions :)