Fork me on GitHub
#fulcro
<
2020-06-11
>
bbss05:06:10

@tony.kay wow, the video's on reducers and hooks are what I've been wondering about for a long time. Since I like hooks a lot I wanted to ask "how about a use-query hook?" but didn't want to impose something that costs a lot of work on you. It's very useful to see how to go about extending fulcro with it. Very informative to see a couple of approaches! Thanks.

mruzekw06:06:53

See use-query-subscription

mruzekw06:06:20

And use-child-sales

bbss06:06:30

@mruzekw thanks! use-query-subscription was exactly what was shown in the video 🙂

mruzekw06:06:50

Oh, right haha

bbss06:06:55

might look into using workspaces as well.. Not sure if it'll be worth it. Do you use it?

mruzekw06:06:16

I haven't used it much. Can't vouch for it either way

bbss06:06:21

used defcards a while back, I can see the use for it when you have a complicated UI that is composed in a lot of different ways. Always found the "shows environmental coupling" feature interesting.

mruzekw06:06:49

Well if you're using fulcro, I'd definitely give workspaces a look, if only cause a major user of Fulcro, NuBank, made it https://github.com/nubank/workspaces

Jakub HolĂ˝ (HolyJak)07:06:45

@bbss ☝️ uses Fulcro 2, Tony has a fork in his GH updated to F3

bbss07:06:31

Ah, thanks for saving me some time when I inevitably would have run in to that!

bbss06:06:09

will do :thumbsup:

zilti14:06:01

Is Fulcro Inspect currently broken by any chance? Chromium 83.0.4103.97 on Linux. The toolbar icon correctly states "Fulcro app detected!" but when I click the Fulcro Inspect tab it says "No app connected."

JAtkins14:06:03

It does this to me pretty much randomly. Have you tried reloading? Closing/opening devtools? Closing that tab entirely to garbage collect it? Usually one of those fixes it for me.

zilti14:06:17

I tried closing and reopening the entire browser, without success

JAtkins15:06:20

Hm. That's unfortunate. Must be a different bug than I'm experiencing.

zilti15:06:13

Hmm I noticed I can right-click into the inspector window and say "inspect" to open a separate window with chrome dev tools. There I get "Error: no reader function for tag fulcro/tempid."

JAtkins16:06:05

Well, that is especially interesting, since I see this in my fulcro inspect:

dvingo16:06:49

@U2APCNHCN I was running into that problem as well, and added a fix for it recently (https://github.com/fulcrologic/fulcro-inspect/commit/1ae196461d60b68d933a3225395c66a0d6a87081). you may want to try installing from the chrome store again to get an up to date version

zilti16:06:18

Oh neat, that fixed it, thanks!

cjmurphy14:06:15

When the Clojure REPL is starting I'm getting an error I don't understand: "Caused by: java.lang.Exception: Unable to resolve spec: :com.fulcrologic.rad.attributes/attribute". It seems to be saying that the guardrails defined function new-attribute (in file com.fulcrologic.rad.attributes.cljc), that returns an ::attribute , can't find the >def for ::attribute, even although it is right there 4 lines above.

cjmurphy14:06:19

It comes from 'Syntax error macroexpanding' a defattr . Which makes sense because the defattr macro calls new-attribute .

cjmurphy14:06:22

When I disable guardrails the problem goes away.

coetry17:06:23

Hey friends, if I wanted to generate a completely static html export of my app. Is there a way to do this in Fulcro? I'm going for something along the lines of what's provided by Next.js or Gatsby.

tony.kay17:06:30

@coetry Yes. If you’re doing it from js (i.e. node or within the browser) you can just use React’s server render code, which does exactly that. On the JVM (Clojure) you can also do that in Fulcro (which you cannot in others) because there is an implementation of the base factories. See Server Side rendering in docs. The down-side in JVM is if you use js components, they won’t render, and you have to write you UI in CLJC.

Jakub HolĂ˝ (HolyJak)18:06:07

Hello! What is the right way to load data into the root of the DB? I have this component, loading a list of deals (having a pathom resolver from :deals to a list of things):

(defsc HotDeals [this {:keys [deals]}]
  {:query [{[:deals '_] (comp/get-query Deal)}]
   :componentDidMount (fn [this] (df/load! this :deals this))}
  ...)
I think this is wrong as it will load {:deals [...]} from Pathom and place it under :deals in the DB so that I end up with {:deals {:deals [..]}} , no? How to correct it? Thank you!

Jakub HolĂ˝ (HolyJak)19:06:25

Hm, perhaps I should have instead used (df/load! this :deals Deal) which will send the correct query to Pathom and store it as expected....

👍 3