fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
2021-03-09T00:42:01.223700Z

let’s say I create an entity optimistically in the action of a mutation keyed on a tempid. I transact that server-side and then want to return that “fully resolved” entity with additional data. what’s the best way to do that? to me, I could either parse the result in ok-action or use m/returning. the latter feels simpler but not sure how tempid resolution works with m/returning. any ideas would be much appreciated!

2021-03-09T13:50:19.226500Z

appreciate the response, and thanks as always for the work you’re doing with fulcro

tony.kay 2021-03-09T01:44:52.224Z

No, not in the magic interpretation. If you write initial state as a fn, then you can do whatever you like with the params.

tony.kay 2021-03-09T01:45:45.224200Z

The problem is without a param ns the magic could get confusing with respeect to what is a prop (for error checking), what is a literal keyword, and what should be pulled from “params”

tony.kay 2021-03-09T01:47:07.224400Z

returning

tony.kay 2021-03-09T01:47:30.224600Z

tempid resolution works in the correct order, so tempids are resolved first (moving the in-db version you had to the correct location), and then the merge

tony.kay 2021-03-09T01:48:24.224800Z

So, as long as your mutation returns tempids remaps, it should be fine. This is, in fact, what RAD’s forms do. They save (new or modified), and they add a returning on the save mutation to return themselves to make sure you see everything that might have changed in db.

2021-03-09T02:21:50.225100Z

Ok - got it. That makes sense. :thumbsup:

Marcus 2021-03-09T13:37:42.226400Z

Do we have examples of fulcro used in live/production systems?

Marcus 2021-03-10T11:28:57.239800Z

@holyjak just in general. I'm just wondering about how widespread it is.

tony.kay 2021-03-09T14:45:39.227800Z

I have worked on more than one commercial project of over 60kloc, and the one I’m currently working on is over 120kloc. None are open source.

👍 1
tony.kay 2021-03-09T14:51:24.228100Z

Most have been b2b, so not really consumer facing

xceno 2021-03-09T16:57:50.228400Z

I started with fulcro roughly a year ago and we're running in production on AWS / Datomic Ions. No complaints so far 🙂

👍 1
Aleksander Rendtslev 2021-03-09T18:05:31.233400Z

One question: What are your thoughts on versioning the API? I love how close coupling is between client and server. It significantly reduces overhead (I even wrote a late night love letter to Fulcro the other day: https://world.hey.com/aleksander/why-i-clojure-fulcro-edition-f12b9976) However, unlike web, I can't guarantee clients will be up to date on mobile - and I feel like the risk of "accidentally" breaking old clients might be quite large with Fulcro. I believe and hope I can do it by setting up proper guidelines for mutation/resolver changes, but I was wondering if anyone else has given this any thought?

👀 2
Casey 2021-03-09T19:07:24.235100Z

I'd like to wrap a js react component in the factory helpers (like from https://github.com/fulcrologic/semantic-ui-wrapper/blob/master/src/main/com/fulcrologic/semantic_ui/factory_helpers.cljc) but with support for :classes [...]. Could someone point me to the helper function that I could use to turn that vector into a classNames string?

Jakub Holý 2021-03-09T19:12:49.235300Z

We have had an internal app for a year... Are you asking in general or about publicly accessible stuuf? I believe people have built a lot but most not public...

Jakub Holý 2021-03-09T19:15:18.235600Z

No. Can you follow what Rich propagates and never break clients? If you need a breaking change introduce a new name(space).

lgessler 2021-03-09T19:50:21.236Z

Hmm, if you absolutely had to make breaking changes in your pathom parser I think it'd be best to maintain the old version(s) and make a new one, right? That could be accomplished by having different parsers run on different http endpoints, or by requiring that all requests come in with a :api-version keyword or sth similar

tony.kay 2021-03-09T22:25:32.236800Z

So here’s my take after 5 years of working with the system: It has never been an issue, assuming you follow a few simple principles: • A namespaced keyword goes with a particular fact. Period. Aliases are acceptable but should be avoided if possible because the are confusing. The primary directive is never change the meaning of a keyword • Extend by accretion, which is in one of Rich’s talks as well. If you have a mutation and you need a new way of dealing with things, then add a new mutation. Put it in a new namespace. • Don’t remove stuff. You can stop asking for it. You can change the security if need be (which of course is a breaking change, but is a global constraint, not an API specific one). The fact that a resolver is still sitting around to resolve something that no one asks for isn’t really a big deal. Clients pull what they want. The problem with REST APIs is that they have to be pre-designed to fit each use-case. The client being able to pull what it wants is very robust over time and evolution. Got new things to read, add them in! Got new ways of getting from A to B, add in a resolver for the edge. Want a new way to talk about an existing thing? Add a new keyword that resolves to the new variant. I do not expect to version an EQL API. I just don’t ever see the need.

❤️ 2
➕ 1
tony.kay 2021-03-09T22:31:48.237200Z

You should watch this for sure: https://www.youtube.com/watch?v=oyLBGkS5ICk&ab_channel=ClojureTV

tony.kay 2021-03-09T22:32:36.237500Z

at least the first 30 minutes. This applies to Fulcro network APIs perfectly

tony.kay 2021-03-09T22:32:48.237700Z

because they are functional in nature