This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-05
Channels
- # adventofcode (50)
- # announcements (1)
- # asami (29)
- # babashka (56)
- # beginners (19)
- # calva (62)
- # cider (12)
- # cljs-dev (1)
- # clojure (42)
- # clojure-europe (214)
- # clojure-france (4)
- # clojure-italy (1)
- # clojurescript (58)
- # community-development (4)
- # cryogen (6)
- # cursive (7)
- # data-science (1)
- # events (3)
- # figwheel-main (1)
- # fulcro (21)
- # lambdaisland (3)
- # malli (17)
- # mid-cities-meetup (1)
- # off-topic (38)
- # pathom (3)
- # reagent (7)
- # reclojure (1)
- # reveal (15)
- # rewrite-clj (11)
- # shadow-cljs (30)
- # sql (21)
- # test-check (14)
- # tools-deps (1)
- # vim (21)
- # xtdb (5)
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 https://book.fulcrologic.com/fulcro3/ which looks outdated. There is just one mention of the reconciler in this example of the proper docs https://book.fulcrologic.com/#MergingwithaComponent
yeah, just use http://book.fulcrologic.com
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)
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"}},
:com.fulcrologic.fulcro.algorithms.form-state/forms-by-ident
{{: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 {}}},
:note/id
{22
{:com.fulcrologic.fulcro.algorithms.form-state/config
[:com.fulcrologic.fulcro.algorithms.form-state/forms-by-ident
{: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?
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.