This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-24
Channels
- # announcements (10)
- # aws-lambda (9)
- # babashka (14)
- # beginners (166)
- # calva (63)
- # chlorine-clover (4)
- # cider (40)
- # cljs-dev (4)
- # clojure (182)
- # clojure-europe (18)
- # clojure-italy (5)
- # clojure-nl (5)
- # clojure-spec (17)
- # clojure-uk (55)
- # clojurescript (11)
- # core-async (12)
- # cursive (23)
- # datascript (5)
- # datomic (19)
- # emacs (4)
- # fulcro (46)
- # graalvm (2)
- # hoplon (2)
- # joker (3)
- # juxt (1)
- # keechma (2)
- # leiningen (20)
- # malli (1)
- # meander (7)
- # nrepl (1)
- # off-topic (72)
- # pedestal (6)
- # re-frame (15)
- # reitit (7)
- # shadow-cljs (34)
- # sql (14)
- # testing (14)
- # tools-deps (11)
- # tree-sitter (1)
- # vim (14)
- # xtdb (19)
- # yada (3)
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).
The demo will run with it, and most features work (except saving added to-many rows)
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.
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.
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?
@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.
BUT, you have to be careful about tempids, so the returned ID must be remapped so that the resolvers will see the right thing
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.
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))]])
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.
@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.
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.
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 🙂
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.
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 🙂
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?
oops, i mean graphQL notation
okay sure, thanks for looking into it
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
upgrading to 2.3.0-alpha5
solves it
@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
@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.
• 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.
Awesome! I will look at it. I plan to start coding on Friday.
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.
sorry to hear that
@njustice sorry to hear that.
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.
AND I spent the last 9 hrs rewriting reports, so they require less boilerplate (docs not yet updated)
I added an invoice list report so as you add invoices you can go back and edit them.
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.
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)
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.
how do you install these?