Fork me on GitHub

Are there any examples of using :dispatch in mutations? I can't find one in fulcro book.


Just call comp/transact! in ok-action (the env includes app)


I think I may have misunderstood. Do you want to transact a different mutation? Or :dispatch to different section of the mutation?


I want to transact different mutation. I was always doing just comp/transact! in ok-action, but I thought that there is better way.

Jakub Holý (HolyJak)09:03:26

comp/transact!is what the Book uses in such cases so I'd stick with that


I wanted to dispatch one mutation from another.


(in ok-action)


3.1.17 on clojars with new Hooks support. Not heavily tested yet, but well-encapsulated so it should not cause any regressions.

moneyparrot 36

Hey folks, I've been really getting into Fulcro recently to build out our company's admin site (and it's awesome!). One of my entities has lots of properties, so I've broken it out into sub components all sharing the same ID (using pathom placeholders). This works fine for reads, but when I add form-state, the form-fields from the sub form don't get picked up. Which makes sense since add-form-config* won't add fields to an entity that already has form config. I managed to hack a workaround by manually associng the subform fields into the form-state config for the top level form, but now I have to call (merge props {:>/sub-form}) in all my fs/checked? calls etc so that it picks up the subform props. Anything I'm missing? Or am I better off not splitting my large form into subforms? I'm beginning to realize that sub forms are best when the subform has a different ident.

(defsc SubForm [_ _]
  {:query [:sub-form/field fs/form-config-join]
   :ident :form/id
   :form-fields #{:sub-form/field}}

(defsc Form [_ _]
  {:query [:form/field {:>/sub-form (comp/get-query SubForm)} fs/form-config-join]
   :ident :form/id
   :form-fields #{:form/field}})


@moocar I’ve not tried that specifically, but add :>/sub-form to the parent :form-fields and see what happens


Yeah, I had the same thought. I tried it, and it does pick up the subform, but the subform doesn't contain any fields. I guess because they're sharing the same ident


technically that should probably work. I designed form-state before we realized that placeholders were even a thing


dirty fields and such might not work right in the diff calculation, since it would find the same ident more than once.


that said, it would not be that big of a change to fix it to work I think


another approach is to put the query and form fields on the parent, and make the sub-renderers plain components or functions (wihtout queries)


Yeah, I think this will be the "easiest" solution for now. Thanks for the suggestions!


I think I may have found a small bug in StringBufferedInput … when I have a pristine form, and then make a single change to a SBI input, then reset the form, the SBI input doesn’t reset. This change fixed it for me Unfortunately I don’t have time at the moment to make a test, etc


thx, added to develop branch


in 3.1.18-SNAPSHOT

Jakub Holý (HolyJak)22:03:06

Does it ever make sense to have get-query without wrapping it in a join, ie {..} as in: :query [:my/child (comp/get-query SomeChild)] ? If not, would it be feasible to add a check and a warning for the omission of the brackets?


no that would not make sense


comp/defsc already does some compile time checks, i suppose you could add more there


and shadow-cljs has hooks for displaying them nicely, via exceptions