fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
tony.kay 2020-12-25T03:49:36.324700Z

wasn’t a missing diagram, was a duplicate sentence I think

tony.kay 2020-12-25T03:50:01.324900Z

Should do that automatically, might be an oversight

tony.kay 2020-12-25T03:50:15.325100Z

you put enumerated-labels on the attr, right?

tony.kay 2020-12-25T03:50:34.325300Z

you can add a column-formatter as a workaround, but it’s just me forgetting to handle the case probably

Christopher Genovese 2020-12-25T22:33:47.330400Z

I'm new to Fulcro, having built a bunch of re-frame/reagent-style apps in the past. My new project seemed like a great time to try it, and after digging in to the details, I also realized that RAD almost perfectly fits my needs. I'm still figuring RAD out and am unsure whether to use RAD or go with plain Fulcro. So I have two immediate questions on RAD. First question: I'm stuck using Mongo in this project; what's the easiest path to using the key-value-store adapter with Mongo? I'd like to keep it simple if possible. Second question: Can attributes be dynamic? In the database, I have one or more user-defined (and user-named) fields that can be discovered at run-time (and change at most slowly). What's the best way to include such data in attributes and reports? (If I'm understanding correctly, dynamic queries in plain Fulcro can handle this, but the corresponding practice in RAD is unclear to me.)

tony.kay 2020-12-26T17:44:52.335900Z

Yes, defsc ultimately (in js) calls configure-component!. You could load all of your component options from some store, and use it directly. You’d have to use dynamic queries to update the UI tree’s idea of the data graph.

tony.kay 2020-12-26T17:45:21.336100Z

The whole system is designed around the possibility of doing exactly these kinds of things.

tony.kay 2020-12-26T17:46:47.336300Z

As far as attributes go in RAD: They are just maps. Those are easy to make and store however you want. You would have to make a more dynamic db plugin, but if you look at the existing code you’d see how simple that would be. The toughest part would probably be getting pathom to update its indexes, which could be as sample as just making a new instance of the parser as needed over time.

Christopher Genovese 2020-12-27T03:55:10.346900Z

Thanks, Tony. That's very helpful. What's the best model to start with for creating a Mongo db adapter?

Christopher Genovese 2020-12-27T04:00:21.347100Z

Thanks, @tony.kay. That's very helpful. What's the best model to start with for creating a Mongo db adapter?

tony.kay 2020-12-27T06:16:13.348Z

Look at rad kvstore

Christopher Genovese 2020-12-29T04:28:50.375600Z

Sorry to continue with this @tony.kay, but I want to make sure I am clear on the options. It seems that to use RAD my choices are to write a konserve backend for mongo (and integrate it with kvstore) or create a more direct RAD adapter. Given that time is a nontrivial issue here, I need a simple functional starting point, so I'm inclined towards the latter. What is the minimum interface that an adapter needs to support? It's not really clear to me from the existing adapters or the RAD book. I can easily get data into clojure in a nice form and can write Fulcro resolvers for it, but I'm not sure what the easiest way is to connect these to the RAD magic. Thanks for your help!

tony.kay 2020-12-29T06:54:43.376500Z

There isn’t really much magic on the back-end at all. You have to have resolvers that can resolve queries. The generated resolvers in Datomic are really trivial when you use the recommended approach: id in, attributes out. The main thing an adapter really does is save, which is just a conversion of a normalized diff (see Fulcro form-state) to a database write. Really that’s about it. In Datomic that’s just a few hundred lines. But, since the normalized diff is a complete description of a graph change, it gives you a fully-general write mechanism. At that point you can write your server-side mutations in terms of form save (manually generate a diff and pass it to the form save, which in turn will use the db adapters and distribute the values to the corrected db(s)).

tony.kay 2020-12-29T06:55:17.376700Z

The normalized diff is trivial: {[:person/id 3] {:person/name {:before "Bob" :after "Joe"}}}

tony.kay 2020-12-29T06:56:30.376900Z

From there an adapter could support additional helpers. E.g. schema generation, schema validation, reverse eng tool -> attributes, etc. etc. But really the only things the front-end needs are the ID-based resolvers and diff->txn functionality.

Christopher Genovese 2020-12-29T16:08:41.385800Z

That's very helpful. I appreciate it!

2020-12-25T23:06:55.331500Z

I noticed index.html was removed from https://github.com/fulcrologic/fulcro-rad-demo. Is one supposed to create this file instead? Is that why it was misleading? (pardon the beginner question)

2020-12-27T01:29:51.345500Z

thank you, that makes more sense. I was mistakenly using the the shadow-cljs server url instead of the one spun up dev:datomic

Tyler Nisonoff 2020-12-25T23:22:18.331700Z

The initial html for the app is generated dynamically here: https://github.com/fulcrologic/fulcro-rad-demo/blob/f840996486fcedfaa3871443ca7499ed3a3cf62a/src/shared/com/example/components/ring_middleware.clj#L16 so you shouldn’t need to create one manually!