Fork me on GitHub
#fulcro
<
2018-05-01
>
grant17:05:26

What is the recommend way to do non-data-driven fetches? I need to hit a server with a REST endpoint with basically static data (JWT public keys) in a JSON file. It seems like there should be a pretty easy way to do this, but I'm missing it somewhere.

tony.kay18:05:27

just use goog XhrIO

grant18:05:54

Ah, gotcha, don't try to go through the fulcro networking.

tony.kay18:05:59

if you need it to go into app state you can use merge-component, transact against reconciler, or simply swap on the app state atom

tony.kay18:05:26

well, if you want to use it as a proper remote, then add it as a remote

tony.kay18:05:36

but you said non-data-driven

tony.kay18:05:27

if you want async separation from the UI layer, then I’d recommend adding a remote and using transact

grant18:05:11

Yea, I'd just be hitting a URL and the cutting up the data. I wasn't seeing anything but overhead in making it a remote. But I am trying to do things the idiomatic fulcro way so that I learn it.

tony.kay18:05:08

The pathom library is getting async support so you can write a parser for the remote…then you could parse out the fulcro query into the various REST calls, have them async fulfilled, and then feed back the result. That is “the way” to do this when REST is a serious part of your back-end

grant18:05:25

It's only going to be needed for interacting with servers I don't control. Anything that is mine will be Datomic style requests.

tony.kay18:05:13

Wilker just gave a talk in Amsterdam at Clojure Days

tony.kay18:05:19

you should watch it…so cool 🙂

grant18:05:44

Oh, that would help. I was looking at Pathom's docs and feeling lost.

tony.kay18:05:23

but not sure if they’ve posted the video yet

tony.kay18:05:15

If I had to talk to almost anything in Fulcro that isn’t Fulcro, that’s how I’d do it

grant18:05:35

Sweet. Thanks.

tony.kay18:05:51

Oh, and I did one on pathom sync as well…for Fulcro

tony.kay18:05:57

it might help you understand the basics

tony.kay18:05:24

this one is server-centric, but it shows pathom

tony.kay18:05:34

from there, just switching to the async api should do it

tony.kay18:05:54

same concepts for turning pull syntax into “something else”

tony.kay18:05:25

starting at 16:42

grant18:05:22

Cool, will watch both of those and beat on it some more, hopefully I can get things to start clicking.

tony.kay18:05:50

let me know how it goes. I think you’ll be pretty impressed with it

tony.kay18:05:23

That library is the “missing piece” for the “integration” story with non-datomic things…very important

grant18:05:57

Will do. Thanks.

currentoor20:05:03

So just to make sure it should be possible to use a fulcro client + pathom for a graph QL backend right?

currentoor20:05:53

The graph QL ecosystem is looking pretty impressive and I was thinking about using a graph ql as a service provider to do some prototyping.

currentoor20:05:40

I’d need to convert fulcro queries into graph ql and convert the response JSON into clojure maps with namespaced keys

wilkerlucio20:05:20

@currentoor yes, but currently its not production ready, more a POC, but its a matter of putting effort on it, I found no "big barrier" that would not make it possible

currentoor20:05:03

if so, then it seems like fulcro would be the only clojurescript framework that could work well with graph QL

currentoor20:05:18

which could help with adoption?

currentoor20:05:56

relay doesn’t seem like it can work very easily with cljs, and it’s so far from idiomatic

currentoor20:05:04

adoption of fulcro i mean

wilkerlucio20:05:36

this is one of the main motivations to work on this feature, enabling the reach into graphql ecosystem 🙂

currentoor21:05:08

there are several graph ql as a service providers, and the tooling around graph QL looks great

currentoor21:05:44

discoverable docs, query building, chrome plugins

currentoor21:05:55

my friend gave a talk about the current state of graph ql in cljs recently https://www.youtube.com/watch?v=sFUd-CtnJv8

currentoor21:05:21

the analogy he used is a little weird though…

wilkerlucio21:05:40

cool, I would check it out later, gotta move now, cya