Fork me on GitHub
#fulcro
<
2020-01-23
>
Chris O’Donnell00:01:39

@mdhaney there was some discussion of workarounds for that transit conflict at https://clojurians-log.clojureverse.org/fulcro/2019-12-27

mdhaney00:01:59

I have a quick patch working now. I’ll submit a PR and you can take a look and let me know if you can think of a better approach, but at least this is working.

mruzekw00:01:17

Are there any advantages of Fulcro over Relay?

mruzekw00:01:48

Is there anything more than CLJS over JS?

mruzekw00:01:09

It looks like Relay takes a similar approach with respect to query building.

mruzekw00:01:47

They also optimize transactions for different cases like spotty internet.

mruzekw00:01:02

I wondered if Fulcro addresses that and more?

thosmos01:01:19

@mruzekw I use Fulcro for many reasons, too many to list here. But one of them is the option to use EQL via Pathom over the wire instead of JSON via GraphQL. This one thing made it possible for me to create an autogenerated API endpoint for 30 or so complex tables in a day vs days and days of intricate schema building and input parsing. Ugh. (= (+ Fulcro Pathom Datomic) winning) in so many ways for me. Your mileage may vary. As for spotty internet handling, that’s more of an app concern that I don’t think Fulcro handles for you. It could be added as a plugin to the network layer pretty easily. I will eventually need to do that, but I’ve done that in various ways over the years and I see that as a nice thing to have in the box, but not a deal breaker. The original primary raison d’être of Fulcro’s predecessor Om.Next was to have graph query UI system that integrates nicely with Datomic’s pull syntax. So if you’re using Datomic it’s a no brainer. If not, hmm, I just can’t say because I haven’t done that.

mruzekw01:01:02

Sure, please share that when you do build it 😊

mruzekw01:01:29

I was just curious how it measured up feature-wise. I love CLJ(S) for its simplicity and beauty. And I love the model Fulcro employs, but I noticed how similar it seemed to Relay

thosmos01:01:08

Relay was one of its primary inspirations, along with Falcor

mruzekw01:01:21

It seemed so

thosmos01:01:54

There are some great talks by David Nolen back around the time he started it on YouTube in which he discusses the design philosophy

mruzekw01:01:09

Yeah, I should rewatch those

mruzekw01:01:14

Been years

mruzekw01:01:18

You mention easy use with Datomic. Are EQL and the pull syntax the same?

thosmos01:01:36

Why are you considering CLJS + Fulcro vs JS + Relay? Let’s assume the features were more or less equal.

mruzekw01:01:02

Just the investment to dive into CLJS for a major project

mruzekw01:01:17

Plus thinking of team on boarding

thosmos01:01:22

Yes EQL is very similar to datomic pull syntax with the exception primarily of mutations

mruzekw01:01:41

And availability of devs for the project down the line

thosmos01:01:06

Yeah I mean honestly, if you’re kind of 50/50 on the tech, then the team building is a huge factor. This was a major stumbling block for a project I worked that couldn’t afford good quality CLJ talent, and wanted to hire cheap foreign JS devs. It’s a real issue

mruzekw01:01:50

Indeed. I know the moment we want to bring on paid devs, it will likely be steeper than the JS alternative

thosmos01:01:10

possibly, but generally worth it. You get what you pay for. I think if you can pay a decent living wage, then it’s not a big difference, and CLJ is worth it. There are countless testimonials. But if you’re looking for the cheapest of the cheap labor, nothing beats JS for that.

mruzekw01:01:59

You make a good point. I love the Clojure community and photography, so maybe it’s worth paying for that

mruzekw01:01:08

Philosophy

mruzekw01:01:13

Sorry, on phone

thosmos01:01:34

If you have the choice might as well

mruzekw01:01:38

Clojure devs seem to be good eggs 😊

mruzekw01:01:48

You don’t come to and stay with a language like Clojure without some good deal of thought and convincing

thosmos01:01:09

We should’ve started a thread way back there. Yeah for me it’s really a bunch of synergistic things. There are individual things I like about other options, but when I add them all up, Clojure wins big time. And really, one of the big things is being able to leverage Java and JS things too.

thosmos01:01:30

Same language front and back ends

mruzekw01:01:02

For sure. Do you have any experience with Datomic Cloud and Ions?

thosmos01:01:07

Simplicity, design ethos, immutable data, data-oriented, rich extensible data format (this is big for me)

mruzekw01:01:13

Are they worth looking into?

thosmos01:01:39

I don’t have any experience. I think they’re worth looking into

thosmos01:01:58

What’s your project? Any required tech stack?

mruzekw01:01:07

Hm. Alright.

mruzekw01:01:45

It will likely be on AWS. It will be a video hosting service, so UI and transcoding pipelines for that

thosmos01:01:56

My project is for non-profits and I’ll move to Cloud when/if it’s making enough money to justify. In the mean time it’ll run on a little DigitalOcean droplet

thosmos01:01:37

Ah sounds big

mruzekw01:01:47

Yeah, has the potential

mruzekw01:01:24

I’m liking serverless architectures as well

thosmos01:01:31

Do you plan on using a lot of JS NPM for the UI?

mruzekw01:01:33

Hence the AWS focus

mruzekw01:01:53

I’m not sure but I’d like access. I know there’s shadow-CLJS

thosmos01:01:17

I haven’t done a side-by-side comparison, but I’m pretty sure using webpack you can get a smaller JS executable

thosmos01:01:44

You can do a double build with webpack and CLJS but then you have more issues with externs.

thosmos01:01:20

I just use shadow-cljs and it handles NPM stuff, but I’m pretty sure it doesn’t get as small because it doesn’t do tree-shaking of the NPM stuff

mruzekw01:01:51

Right, as far as I know, there is no tree shaking except for the closure libs and the app code

thosmos01:01:01

but that’s something to ask on #shadow-cljs

mruzekw01:01:54

So you were able to go from Datomic database to Panthom backend in one day?

thosmos01:01:13

yeah, that said, doing SSR with loadable modules and sending over a pre-rendered page with a small JS file and data is totally doable. I’ve rolled this custom myself in the past.

mruzekw01:01:16

Did you need to write the Pathom resolvers manually? Or is there an automated alternative?

thosmos01:01:20

Yes, I set up 2 pathom resolvers, one for idents, and one for general table lookups for ~30 tables that I migrated from MySQL to Datomic. I use my own spec file to describe all of the tables and columns (entities and attributes in Datomic parlance)

thosmos01:01:48

automated?

mruzekw01:01:56

spec = clojure.spec?

mruzekw01:01:08

I guess integrated would be a better word

thosmos01:01:28

spec == my own custom specification

mruzekw01:01:43

I’m thinking of something like generated GraphQL resolvers with something like AppSync or Hasura

mruzekw01:01:26

Oh! Does this repo have an example of the resolvers you mentioned?

mruzekw01:01:12

Thanks! This will be nice to reference

mruzekw01:01:35

A client project or your own?

thosmos01:01:41

yeah it handles paging, filters, sort, etc

thosmos01:01:48

Yes, this is my current project

mruzekw01:01:13

Thanks for sharing

thosmos01:01:27

my pleasure

thosmos01:01:45

glad to be working on something I can share. Much of my work over the years has been closed source

thosmos01:01:01

There’s a lot of hackery in there (learning by doing)

mruzekw01:01:05

Yeah. I understand

mruzekw01:01:16

Nice to have an open source project or two

thosmos01:01:48

I just pushed my latest changes. I will probably change the lookup-resolver to build on the map-form of Datomic query. instead of the vector form. I’m surprised it’s worked so far, but can be a little hard to parse what’s going on.

thosmos01:01:27

I also use this little library i made to convert the specs into various things like Datomic schema, datascript schema, etc: https://github.com/thosmos/domain-spec

mruzekw01:01:54

The idea of having just two resolvers for pretty good base API from Datomic, Pathom, and Fulcro seems like something worth sharing

mruzekw01:01:14

Do you a github gist or blog post about it?

thosmos01:01:27

I will … there’s a lot I’m doing in the app that I think is innovative 😉 hehe and yes planning to write about it

mruzekw01:01:21

Do you have a place you post so I can look out for it?

thosmos01:01:27

https://code.thosmos.com my latest post describes some of the design goals

thosmos01:01:03

that was written before I made the leap from react + JS + graphql <-> lacinia + datomic to Fulcro + Pathom + EQL <-> datomic. I’m so much happier now!

mruzekw02:01:11

Less work / code I presume?

thosmos02:01:46

yes I think so, even though I’ve built my own replacements for some of what react-admin provided

thosmos02:01:57

I think the crux of my decision is based on my design goal of using my domain specs to generate as much as possible. so now I have one list component that can be used for all the different tables, one dropdown lookup for references to joined entities, etc

mruzekw02:01:26

Certainly sounds powerful for what you’re doing

thosmos02:01:34

Yeah it makes doing a bunch of similar CRUD stuff so much more realizable in a relatively short time. The universal list is in this file: https://github.com/thosmos/riverdb/blob/master/src/main/riverdb/ui/theta.cljs

👀 8
👍 4
thomas08:01:37

@tony.kay thank you, that did the trick. 🙏

sif15:01:15

Hello, I have two dynamic routers, one inside the other (composed) but I can't get it to work, I always get couldn't find route target for new-route Any help please?

tony.kay16:01:38

@sifou the book covers everything I can think to say…you have route-segments? You composed in initial state?

tony.kay16:01:27

There is really only one primary incantation in Fulcro: Make sure query/ident/initial-state are right (the latter is for initial startup state).

tony.kay18:01:16

from there everything is an API you could write yourself. Dynamic routing is just one way you could move around in the app, and it’s API is one of 3 included.

sif19:01:14

That was it @tony.kay missed composing initial-state, thank you for your work.