Fork me on GitHub
#fulcro
<
2020-03-24
>
tony.kay03:03:16

RAD progress: I’ve got the SQL adapter mostly working. I have not tested all data types (and those implemented are limited), and save only partially works (saving to-many refs are not yet implemented).

tony.kay03:03:52

The demo will run with it, and most features work (except saving added to-many rows)

tony.kay03:03:36

I plan to finish the ref-many save, and possibly expand it a bit as I add features to the demo. The nature of RAD itself as a rapid-dev/prototyping system doesn’t need much more since it is easy to add save middleware and additional resolvers to customize it to any advanced schema or database-isms.

👍 20
🎉 4
bbss12:03:22

I did some adjustments to the rad datomic adapter code and so far it's working with datahike. I'm following fulcro-rad-demo but have an issue with a simple model form, the model just has a id uuid and a name string. When saving the form, the transaction succeeds, tempids -> uuid in :tempids. the id and name field are in the datahike db, but after the :event/saved the name disappears, it's not in the view nor db. Don't see anything in the console output that could explain it.

🎉 4
bbss13:03:24

seems the form does work when I comment out https://github.com/fulcrologic/fulcro-rad/blob/develop/src/main/com/fulcrologic/rad/form.cljc#L766 wrap-datomic-save just returns the tempids map, not the entity, I'm guessing that's what the handler argument is for?

tony.kay14:03:31

@bbss Fun! OK, so the returning has to do with re-loading the form’s content after the save…it adds a complete query to re-populate the form from the db, and that relies on your resolvers all working right for reads.

tony.kay14:03:46

BUT, you have to be careful about tempids, so the returned ID must be remapped so that the resolvers will see the right thing

tony.kay14:03:35

Fixing fulcro-rad-datomic to support the client API would be nice, too 😉 There aren’t too many things that would have to be done. Ident resolution is using the entity API, and pull-many I don’t think exists on client…but most everything else would work I think…and that would give us cloud support.

bbss08:03:00

Alright, what I did for datahike: • replace datomic.api require with datahike.api • remove datomic.function require • remove datomock and replace fork-conn and mock-conn with (d/connect real-connection), I didn't run this code so I'm sure it's prob not what we want. • replaced transaction functions with: {:db/ident :com.fulcrologic.rad.fn/set-to-many-enumeration :db/fn set-to-many-enumeration-fn} {:db/ident :com.fulcrologic.rad.fn/add-ident :db/fn add-ident} • those were plain functions with :code as body , :params as arg-vec and datomic.api/pull is replaced by d/pull what I did for datomic cloud was a while back so a bit hazy and slightly different adapter codebase: • replace datomic.api require with [datomic.client.api :as d] • in replace-ref-types replace (comp :db/ident (partial d/entity db) :db/id) with (comp :db/ident (partial d/pull db '[*] ) :db/id) - replace pull-* (`d/pull-many db pattern eid-or-eids)` with (into [] (map (fn [eid] (d/pull db pattern eid)) eid-or-eids)) • there was no need to install the transaction functions, define in ns and call quoted in transaction form, db is passed as first arg e.g.: (ref->ident after) (if (nil? after) [[:db/retract (str id) k (ref->ident before)]] [['(my-namespace/add-ident (str id) k (ref->ident after))]])

bbss08:03:17

Not sure how to split it up properly. Probably different keys on the attributes. But not sure if looking up attribute type every time when we need to find out which is a good idea.

cjsauer14:03:56

@tony.kay I wonder if the pathom-datomic plugin would be useful https://github.com/wilkerlucio/pathom-datomic It sort of abstracts over these differences already.

cjsauer14:03:20

Or even something like igraph which was introduced recently https://github.com/ont-app/igraph I’ve been pondering its relationship with pathom. All these “graph-like things” might benefit from a common interface.

tony.kay15:03:51

The resolvers are a trivial amount of code in the adapter. The save conversion is most of the code is at. That said, a simple library that is meant to deal with the issue of making pull pull the db/ident when you have a scalar that is represented as such is pretty simple, and not worth an extra library. Pull-many is equally simple to build without the need. But I’ll glance at them 🙂

tony.kay15:03:37

Wilker’s lib might be nice. I don’t have time to try it and see where it might fall down, but it might be quite simple to add in and try if someone wants to. Just go to the demo and add it into the parser plugins, and remove the auto-generated datomic resolvers that RAD has.

cjsauer15:03:39

Cool, I might give it a try. First tho I’d like to read into the RAD source a bit. It’s on my todo list 🙂

Thomas Moerman14:03:22

Hi, I'm having a bit of a weird problem: when passing mutation params with (m/with-params some-map), to a graphQL endpoint (using Pathom, Fulcro 2.8), nested child fields are not formatted as json but as {"string": "string", ...} , there's probably something obvious I'm missing here? Any suggestions?

tony.kay15:03:20

how is that not JSON?

Thomas Moerman15:03:09

oops, i mean graphQL notation

tony.kay15:03:52

might ask in #pathom , I’m not involved with the GQL stuff

Thomas Moerman15:03:16

okay sure, thanks for looking into it

Thomas Moerman17:03:41

Found it! Just dropping it here for future reference: it was not yet supported by the Pathom version I was using: fixed here: https://github.com/wilkerlucio/pathom/commit/b50420255c4c960ebb73738706fbc77be7c9f08d#diff-5ce19d6f939fdbae19a58e83b57286f1

Thomas Moerman17:03:17

upgrading to 2.3.0-alpha5 solves it

Jakub Holý (HolyJak)16:03:06

@tony.kay Hi! I am goint to make a PoC of an app with a number of linked "reports" (mostly master-detail) and want to take fulcro-rad for a ride. I'd be happy to contribute with feedback, design ideas (since reports are not so much designed yet, I believe), hopefully code. I have put some initial thoughts here: https://gist.github.com/holyjak/314193b66f2207a2349cf3b05ee8f3c3

tony.kay16:03:07

@holyjak Thanks! So, I’m working on reports a bit as we speak. Making them much more compact, and adding both an outer layout and inner layout renderer (by default). My intention is for reports to support easy tabular data out of the box, but to support much more complex layouts/operation in the long run. For example, I consider a kanban board to be a report with filtering and item actions.

❤️ 12
tony.kay16:03:32

• Report: Display of data where mutations are the actions that can drive change (table and row actions), layouts drive rendering, and queries with filters derive the data. • Form: State management of all data displayed. Each level of a form must have a single ID. Saves go through server-side middleware and are sent as minimal diff. So an app like Clubhouse would be a complex report (the story board), and clicking on a card would be a row action that would route to an edit Form for a story. So, let me get through today’s refactoring of reports, and I’d love to see what you think from there.

Jakub Holý (HolyJak)17:03:43

Awesome! I will look at it. I plan to start coding on Friday.

njj16:03:56

Is there a resource for Fulcro jobs (companies that use Fulcro, etc..)?

tony.kay16:03:22

not that I’m aware of

njj16:03:14

I would be interested to see if there are any companies hiring who use Fulcro. I recently was laid off due to the pandemic and my day to day involved a large scale Fulcro application.

😿 36
sif18:03:55

sorry to hear that, the same exact thing happened to me.

currentoor22:03:11

sorry to hear that

tony.kay20:03:57

RAD update: So, the RAD demo (on master branch) is a working release that works for SQL or Datomic (according to instructions in README). Both use free in-memory dbs (h2 and datomic-free) so they’ll spin up without any external installations.

tony.kay20:03:27

I pushed the first alpha release of the SQL adapter

tony.kay20:03:59

AND I spent the last 9 hrs rewriting reports, so they require less boilerplate (docs not yet updated)

tony.kay20:03:26

I added an invoice list report so as you add invoices you can go back and edit them.

tony.kay20:03:22

And of course it’s the exact same front-end for both back-ends. Futhermore once we get some alternate render plugins, it’ll be the same front-end for web/native.

🤯 8
tony.kay20:03:58

There is also a bump on Fulcro to 3.1.22 which adds a bit to multiple-root support (props passed from parent are passed through to new root as computed)

Peter Wilkins20:03:18

does anyone have any nifty intellij live templates for fulcro they care to share? I've seen a good one for defsc in the videos.

tony.kay21:03:50

yeah, I can share that

tony.kay21:03:05

settings file for IntelliJ with just live templates.

👍 8
12
currentoor21:03:45

how do you install these?

tony.kay21:03:49

File -> Import Settings

👍 4
tony.kay21:03:12

if you have sync turned on that may not show up…not sure what you do then

tony.kay21:03:26

read the XML in the zip file? 🙂