Fork me on GitHub
#fulcro
<
2019-07-31
>
exit214:07:53

Is there anyway built in to Fulcro to conditionally load some data (i.e. profile/by-id), if it already exists then don’t fetch. I could easily do this by checking the state before fetching but wasn’t sure if there was some kind of flag I’m not seeing in the book.

tony.kay15:07:35

Fulcro never analyzes your state to determine your intention. Write a mutation that conditionally submits a load-action.

wilkerlucio16:07:51

@njj there is a trick you can do if you are using pathom, with the data you send for the query you can also send the data you already have, so its like you start processing with that, its quite efficient, we do that to optimize some later data fetch. it would look like: [{([:customer/id 123] {:pathom/context {:customer/loaded-before "some-data"}}) [:customer/name :customer/loaded-before]}]

wilkerlucio16:07:29

so anything in :pathom/context would be considered pre-defined data, the server process will pick from that

wilkerlucio16:07:38

you could also elide current data using :update-query, the advantage of sending it (in case you are using pathom) is that if you need attributes that require some input to process, these inputs can be immediatly available, reducing the processing on the server

Abhinav Sharma23:07:19

Hi guys, is there a way to start a api server and keep it running directly via clojure tool? Here's my use-case: I'd like to have a single command yarn start which start the npx shadow-cljs watch :main and the clojure -A:dev -J-Dtrace -J-Dghostwheel.enabled=true with the initial start command. Something like using concurrently in the NodeJS world. An example of that would be, "setup": "concurrently \"cd server && yarn\" \"cd client && yarn\"" in the package.json.

mattsfrey23:07:07

hey, curious if anyone is using any component libraries with fulcro that have worked well, I have been looking at antizer in particular to use ant design components with reagent, does anyone know if this would work with fulcro?

👍 4
Abhinav Sharma00:08:02

Hi @U12FDCE4V, sure it's possible to do so however, generally speaking the fulcro examples, template rely upon the semantic-ui which has been wrapped accordingly here https://github.com/fulcrologic/semantic-ui-wrapper. As for antizer, I think it should be possible with some experimentation.

mattsfrey00:08:28

cool, thanks for the reply - I’ll check out semantic-ui and possibly play with pulling in antizer

👍 4
tony.kay00:08:50

Ah, the antizer lib is very thin….just look at the semantic-ui wrapper library, and you could copy that same pattern

tony.kay00:08:52

the book also talks about adapting js libs