Fork me on GitHub

Fulcro 2.6.18 is on Clojars , and the Developer’s Guide has been updated. This new release has: - All SVG tags are now in DOM ns - A replacement macro for defrouter called defsc-router. It generates the same thing as defrouter (which still exists and is supported), BUT it has defsc syntax for better IDE integration, and more importantly allows you to do things like define react lifecycle methods on the router itself. This means you can add things like “route change” hooks into the router on :componentDidUpdate and such.

🚀 2
❤️ 2
bananadance 1
💎 1

hey, is there a possibility of combining multiple independent loads into a single remote query when using Pathom resolvers on the server-side? In my :started-callback code I have a lot of:

(df/load app :a/resolver a-sc {:parallel true})
(df/load app :b/resolver b-sc {:parallel true})
These currently fire as separate HTTP requests, but in theory they could be joined onto a single query (in some cases this would also increase performance as there are some interdependcies between the resolvers). I have found this function and the remainder of the ns: But it seems to only work on the old FulcroNetwork interface and is meant for cljs-side resolvers. Am I missing something?


@thenonameguy When you issue loads, fulcro has a small delay and has some logic for batching them into a request. If you put :parallel true they will go to the network directly as separate requests.


oh, so I am shooting myself with that premature optimization. Thanks! I don’t know if it’s missing from the book or I just couldn’t find it, but it might be worth adding a line about this. It totally makes sense though that this is the behavior.


You're welcome 🙂 Seems to be mentioned here, but it's also mixed with the mutation & load order You can override this behavior with the parallel option of load.

👍 1

argh, I was searching for ‘batched’ and skimmed over this.

Björn Ebbinghaus14:12:05

Is it possible to give a workspace fulcro defcard a global state AND an initial state for the "root" component (i am quoting root here, because the root component is wrapped by default).

    {::f.portal/root ui/LoginForm
     ::f.portal/app {:initial-state {:dbas/connection dbas/connection}}
     ::f.portal/initial-state {:id 1 :nickname "bjebb" :password "secret"}}))


what you mean by global state? and the default value for initial state will be used as a param to your root entity, but you can use a fn version on it, then you can return whatever you like

Björn Ebbinghaus10:12:55

With global I meant the root node. I just wanted to add a field to the wrapping root node. But I have to manually add the initial-state of the wrapped component. Example:

::f.portal/app           {:initial-state {:dbas/connection dbas/connection
                                               :ui/root (prim/get-initial-state ui/LoginForm {:id 1 :nickname "bjebb" :password "secred"})}}}))


@U4VT24ZM3 what connection is? it is some stateful thing?

Björn Ebbinghaus13:12:18

yes, in there is data to work with an external API. but since it is only a singleton I don't want to attach it to my LoginForm Component


you can use the :shared support for fulcro, its a bad pattern to add stateful things to the app db, some advanced features might require it to be serializable


this is also easier to set in the workspaces, you can provide as a separated dimension