Fork me on GitHub

Hello 👋 I’m getting a bit confused reading through the mutation section in the developer’s guide regarding the difference between server-side use of pc/defmutation and fulcro’s defmutation; when should I reach for one over the other? Related, I believe there may be a typo in the “Demo mutation joins” section’s code example, which appears to use both forms simultaneously:

(pc/defmutation trigger-error [_ _]
  (action [env]
    {:error "something bad"}))


Use Pathom when you’re using a pathom parser, which can be used on the client (i.e. wrapped in a virtual remote) or server. Fulcro no longer has a server-side defmutation. It is a macro for adding a multimethod dispatch on a symbol for client-side use…it is basically defmethod with some syntax checking and boilerplate reduction that also give code nav convenience.


Having an action inside a pc/defmutation is confusing and almost certainly a typo.

👆 4

Cool, makes sense, ty


So, I had an idea this morning that I just tried out that will be interesting to many people I think. I was inspired to think about the “floating root” idea that comes up at times when @mdhaney mentioned that he was using a js react lib that wanted you to pass in a class…obviously something that is going to be hard to adapt in Fulcro without the ability to “disconnect” the reified UI graph. It occurred to me this morning that it might be possible to do this without any internal changes to Fulcro at all, and in fact in less than an hour this morning I have a working demo. It is not fully optimized, and probably has a bug or two, but shows how simple it is to expand abilities. It is currently on a work-in-progres branch (in two files) here: Basically the idea is to plug in a custom renderer, which itself tracks and manages the extra roots (I used keyframe render 2 as a base, so you could have :only-refresh optimizations). Composing root queries and initial state is just data manipulation (the root query combination is necessary to get initial state to normalize…a complete implementation to do this would do alt root initialization on mount and eliminate that need in the custom renderer by detecting if the state was already there).

metal 20

One hour. No customizations to Fulcro’s code. Floating roots.


for a local database (i.e. sqlite), do we need to create our own remote implementation, or does fulcro's mock-server-remote * serve this purpose?


no, that is for demoing things


a remote is super simple, just a map with a :transmit! key


but you can use that com.fulcrologic.fulcro.networking.mock-server-remote as an example of how to do a remote, given a parser


then with a pathom parser you would implement resolvers that perform operations on your DB


does that make sense?


yes it does, ty