Fork me on GitHub
#fulcro
<
2019-01-30
>
1zaak06:01:07

Hi, Fulcro newbie here. I'm evaluating Fulcro for my startup, and wondering what is the situation for having multiple clients? Is it possible to call the Fulcro API from Android/IOS, React Native/Flutter/etc? AFAIK, the server API is not GraphQL (e.g. Lacinia). Do I need to code a separate GraphQL endpoint for these clients?

myguidingstar06:01:10

@1zaak ideally Fulcro should work with a server API called EQL, not GraphQL. But it's possible to translate EQL to GraphQL (or even REST) via Pathom. That translation can be done right in client app (so no extra server required)

currentoor06:01:51

@1zaak fulcro does work with with react native, and can consume any non EQL APIs, vai pathom, you can use pathom to consume graphQL/REST APIs in the client or use pathom on the server to build your EQL API

myguidingstar06:01:12

However, please note that GraphQL doesn't have tempid and namespaced keywords

currentoor06:01:46

yes both REST and graphQL are missing some features because of their inherent limitations

currentoor06:01:02

you should be able to use fulcro wherever you can use javascript and react

currentoor06:01:14

when i started my current project i originally thought i’d have a graphQL API on the server just to keep my options open

currentoor06:01:46

but then i just decided i’d probably make all my clients fulcro and i much prefer EQL

souenzzo11:01:54

There is a plan to make #pathom expose graphql. I'm (as me, not as pathom contributor) planning to work on that in some days.

wilkerlucio17:01:15

just to clarify this statement, pathom is already able to consume graphql apis, but not to expose then as GraphQL

👍 5
1zaak06:01:23

Thanks a lot for the useful comments @currentoor @myguidingstar ! I'm still understanding Pathom, EQL and how everything fits together, but this is a good starting point. BTW, any comments on the development speed/intensity compared to classical ring/pedestal-hiccup/selme web app? (Just a bonus if I have an answer for this, I am aware of the benefits/downside of a SPA approach)

wei07:01:56

new lein template not support windows, right?

tony.kay23:01:19

have not tried it. Tools deps doesn’t work well on windows, unless you use the ubuntu support.

tony.kay23:01:34

and you need npm etc.

tony.kay23:01:09

but I don’t see any specific reason why windows would be out

tony.kay23:01:02

I think you’d have to use the Ubuntu support to get a clojure command line working.

tony.kay23:01:10

you can also just move the deps into project.clj, and forget about deps.edn

currentoor08:01:38

@1zaak so it depends on the individual but there’s a learning curve till most people finally “get it”, since there are a lot of new concepts

currentoor08:01:45

For the first few weeks/months it might even feel slower (but simpler) but after that you’ll be able to sustain a really good pace of development

❤️ 5
hmaurer20:01:40

Hello 🙂 Is it fine with Fulcro to do a top-level load like this: (df/load app :>/app root/App) in order to load data for a components that wants to query on root?

tony.kay22:01:14

Your use of pathom’s placeholder syntax is confusing and discouraged (by me).

tony.kay22:01:25

otherwise you can certainly load into the root if you want

hmaurer00:01:07

@U0CKQ19AQ is there a better way to do what I am trying to do then? My App component holds a query that needs to be run at the top-level in Pathom

tony.kay01:01:40

why not define a resolver that has a simple key and no inputs? Those are root queries

hmaurer01:01:26

@U0CKQ19AQ So you mean define a :app resolver? Because here is the query I have in App:

{:query [{:all-users [:user/id :user/name]}
           {:current-user ...}]}
Both :all-users and :current-user are resolvers without inputs

hmaurer01:01:53

but df/load takes a parameter which defines the query it runs

tony.kay01:01:56

I’m not sure where the disconnect is…all the placeholder does is “stay in same context” which you weren’t even in…so AFAICT you’re not doing anything but confusing the reader

hmaurer01:01:17

@U0CKQ19AQ sorry, I would like to not use a placeholder, but I simply don’t understand how to achieve the same result without one. As far as I understand when I issue a (df/load app :some-query SomeComponent), it runs :some-query in the root context with the selection defined by :query in SomeComponent

hmaurer01:01:29

But in my scenario the selection defined in SomeComponent is what I want to get on the root context

hmaurer01:01:41

so what should go in place of :some-query?

tony.kay04:01:13

if what you’re doing works, perhaps I don’t understand it…I don’t have more of an answer for you. Load always load to root. Period. What you call the keyword is what it appears as. Period. If you’re targeting, then that is something else.

timeyyy21:01:53

I'm reading the fulcro user guide and have a few questions. http://book.fulcrologic.com/#_using_javascript_react_components mentions that >1. If you are importing third party components, you should be importing the class, not a factory. >2. You need to explicitly create the react elements with factories. The relevant js functions are React.createElement, and React.createFactory. Does this mean it is possible to import js factories if one wraps it with React.createFactory? Why should i prefer using React.createElement? Specifically if there is a factory function that I want to use...

tony.kay23:01:45

I honestly don’t remember 😜 it could have been the force-children thing. It depends on how you want to use the components. Fulcro generates React-compatible things, but children end up as a lazy sequence sometimes, and react doesn’t know what to do with those. If you remember to force the children, then you’re probably ok using their factories.

timeyyy23:02:13

So i have been playing around with using force-children. I tried your react-motion demo project and got to see what happens when the lazy error or with-context error are present. The behavior I am seeing is a bit different, It appears to render fine but without styling, and the functionality doesn't work properly... I might make a git repository showcasing the problem and post it here if that is ok.

tony.kay23:01:29

argh…looks like the demos in the book are missing the js file 😞

tony.kay23:01:27

messed up the file transfer…fixed now