Fork me on GitHub

hello, I'm playing with the new Fulcro raw things, one thing I notice is that (rc/component-instance? (rc/nc [:foo])) returns false because hte result of rc/nc doens't contain fulcro$isComponent true, should it be there?


actually no. nc is a component class, not an instance


however, your question caused me to find a bug 😄


hehe, having some fun with this, prob gonna do a post in the next week 🙂


good to hear. Let me know any other thought


Fulcro 3.5.0-RC2 is on clojars. Fixes a bug in nc where nested queries were not generated correctly.

Timofey Sitnikov20:06:31

I am working with Fulcro Template and on the server, there is a , How can I execute it in REPL? I know that on the client side I can simply (comp/transact! SPA [(login {:username "john" :password "mysecurepassword"})])). How can I do that on the server side. It looks like on the client side the SPA contains the env, what do I use in place of SPA on the server side.


It's no different. You still create a Fulcro app for using transact


everything is CLJC


so, if you're doing server-side rendering you can start the app headless, run your mutations, and then pull the state from the atom and send that to the client.


If you mean you want to run the client mutation on the server for something else, what is that something else? Or do you mean you need to run a server-side mutation? If that's what you mean, and you're using pathom, you call the parser instead of transact.

Timofey Sitnikov02:06:17

@U0CKQ19AQ My question is probably a bit more elementary. I cannot figure out in Fulcro Template, if I try to run components/transact! what do I use for the app-or-comp argument as in the line below?


A Fulcro app


you need to be more explicit about why you want to call transact on the server side


If you mean you just want to cause that mutation to run AS IF you'd called it on the client, then you need to invoke your middleware parser on the transaction


If that's what you want, then after starting the server, you can run:

Timofey Sitnikov02:06:14

For development in REPL, I would like to develop a server side mutation, make sure the output is what I expect it to be. So if I try to run a mutation in Fulcro Template on the client side, I do this:

(comp/transact! SPA [(login {:username "john" :password "mysecurepassword"})]))
On the client side, the app-ro-comp is defined here: It is the SPA variable, What do I use on the server side instead of SPA?


(app.server-components.pathom/parser {} '[(app.model.session/login {...})])


transact! does not run the server side stuff. The middleware receives it as a EDN and runs the parser


so, calling the parser is probably what you're wanting?


if so, define your own dev helper that just runs some transaction on the parser like above

Timofey Sitnikov02:06:06

Ahh, OK, yes I think I understand. Will try it.


The map, of course, is the env that resolvers/mutations on server side get as env


server mutations and resolvers in pathom 2.x are just maps, and one of the keys is the actual resolver fn, which you could also just directly call


What I usually do is define the functionality in a regular function that can be easily unit tested, and then call that function from the resolver. That way you have an easier way to work with it outside of parsing.

❤️ 3
Timofey Sitnikov02:06:42

OK, this helps, I was wondering why the functionality was broken out, specially in Fulcro RAD Demo, seemed like extra files, but now I understand.

Björn Ebbinghaus14:06:07

(specification "Moderator priviliges"
  (let [parser (pathom/build-parser {} *conn*)
        parser-with-alex-session (partial parser {:ring/request {:session {:id #uuid"000aa0e2-e4d6-463d-ae7c-46765e13a31b"}}})]
    (behavior "Only a moderator can"
      (behavior "add new moderators"
                {::process/slug "test-decision"
                 ::user/email "Marc"})])
              {:message "Need moderation role for this operation"}}}))))))

❤️ 3
Timofey Sitnikov11:06:26

It will take a few days to chew thorough this, but looks interesting. I am just starting to get into testing.