fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
2020-12-05T01:59:22.101400Z

Thanks for linking this. Going to check it out sometime this weekend.

2020-12-05T07:28:00.102700Z

Ahh, this is what I was starting to notice so much that I would do a shadow-cljs release every once in a while see how it -actually- performed! I noticed in the profiler the inspect diff was doing a lot. Good to hear that's improved.

Jakub Holý 2020-12-05T07:34:50.103Z

The docstring I found mentions no args and is thus correct:

;; query template is literal. Use the lambda if you have ident-joins or unions.

2020-12-05T16:45:37.106500Z

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?

2020-12-05T17:01:26.107100Z

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

tony.kay 2020-12-05T17:30:50.107800Z

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

tony.kay 2020-12-05T17:31:26.108400Z

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)

2020-12-05T17:35:26.108700Z

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

2020-12-05T17:36:02.108900Z

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

tony.kay 2020-12-05T17:41:19.109100Z

y

tony.kay 2020-12-05T17:42:00.109300Z

ooops. that should redirect

tony.kay 2020-12-05T17:42:20.109500Z

yeah, just use http://book.fulcrologic.com

tony.kay 2020-12-05T17:42:22.109700Z

no suffix

tony.kay 2020-12-05T17:50:29.109900Z

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

tony.kay 2020-12-05T17:51:42.110100Z

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

2020-12-05T17:54:37.110300Z

Got it, ty.

2020-12-05T18:03:57.110500Z

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?

2020-12-05T18:09:27.110800Z

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.

2020-12-05T19:39:30.111200Z

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.

tony.kay 2020-12-05T19:56:51.111400Z

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.

2020-12-05T20:26:03.111600Z

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?

tony.kay 2020-12-05T21:36:00.111800Z

pretty much…there are demos in the book

2020-12-05T22:27:53.112Z

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.

2020-12-05T22:29:49.112200Z

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