This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-01
Channels
- # babashka (30)
- # beginners (80)
- # calva (21)
- # chlorine-clover (2)
- # cider (22)
- # clj-kondo (65)
- # cljfx (2)
- # cljs-dev (3)
- # cljsrn (3)
- # clojure (37)
- # clojure-europe (27)
- # clojure-italy (3)
- # clojure-nl (2)
- # clojure-taiwan (1)
- # clojure-uk (21)
- # clojurescript (13)
- # conjure (23)
- # core-typed (1)
- # cursive (16)
- # datahike (1)
- # datomic (6)
- # docs (2)
- # emacs (5)
- # figwheel-main (1)
- # fulcro (12)
- # helix (11)
- # jobs (2)
- # jobs-discuss (2)
- # leiningen (1)
- # lsp (34)
- # luminus (1)
- # malli (19)
- # microservices (1)
- # nrepl (1)
- # off-topic (25)
- # pathom (6)
- # polylith (47)
- # practicalli (5)
- # re-frame (8)
- # reagent (1)
- # reitit (1)
- # releases (2)
- # remote-jobs (2)
- # reveal (1)
- # sci (1)
- # shadow-cljs (11)
- # sql (8)
- # tools-deps (9)
- # xtdb (16)
I’m using RAD (which is RAD!) and am attempting to add a reverse many-to-many reference to a report list. In other words, the report is listing station
and each station
can be referenced from multiple project
records (:ref :many). On each station
row, I’d like to have a set of project
tags, and the ability to filter the report by project
. I’m not sure how to configure this sort of “reverse many ref” into either the RAD attributes or the report config.
I have reverse refs in my pathom resolvers outputs and underlying datomic query, so I can accomplish this with a query like:
[{:stations/all [:station/uuid :station/Name {:project/_Stations [:project/uuid]}]}]
which passes this to a datomic pull and it returns the appropriate data. What I don’t get is how to incorporate this kind of query into the RAD station
report. Any tips?Actually, I think this might be working. Any gotchas here?
(defattr Projects :project/_Stations :ref
{ao/identities #{:station/uuid}
ao/schema :production
ao/target :project/uuid
ao/cardinality :many
ao/read-only? true})
keep us posted 🙏 For displaying the values this https://gist.github.com/holyjak/207ed33c9ee7e003b9a779fa47c32d91#displaying-to-many-ref-attributes-in-a-report-column-as-a-value-or-a-sub-report can perhaps be of some use?
Oh interesting, thanks for the link. I did #2, but then the column header was missing from the table. So I added an attribute for the reverse link, but then I made the mistake of linking it to the database schema, and couldn’t figure out how to skip the autogeneration of the schema for that attribute. I realized I needed to remove the ao/schema
attribute. Now the report is working and I’m attempting to get a to-many control in the form editor to work.
I finally got it to work! I wound up needing to intercept the delta and rewrite it to change the owning side of the to-many references. https://github.com/thosmos/riverdb/blob/db4567b7eb957d9ee668525c8f48133421dd53e2/src/rad/riverdb/rad/middleware.cljc#L92
I wasn’t able to get the pathom attr resolver approach working like your example, but i already had that part working anyway. However, my approach for the resolvers would not work for the stock RAD setup because I use my own attribute specs to autogenerate my resolvers.
[ANN] https://github.com/fulcro-community/fulcro-exercises has been made vastly clearer thanks to the awesome feedback I received from @alex-eberts Check out the latest version!
Hi, Does anybody have any tips / best practice about combining a recursive attribute with Fulcro RAD? I tried using a normal defattr: (defattr parent :person/parent :ref {ao/target :person/id ao/cardinality :one ao/identities #{:person/id}}) I combined it with a picker which points to a defsc for its query: (defsc PersobParentQuery [ ] {:query (fn [] [:person/id {:person/parent 1}]) :ident :person/id }) It does not end well. :) Any ideas?
In principle that is fine, but in practice I do not think I fully fleshed out recursive support. The resolver generation should be ok with it for Datomic (I think)...would be helpful for you to describe what "not ending well" means.
Thank you for your reply! and for the Fulcro ecosystem! 🙂 I think I get an infinite compiler loop. Since it's mentioned in the developers guide (inside the code for "Example 12. https://book.fulcrologic.com/#RecursiveDemo1") that "calling get query on yourself would lead to infinite compiler recursion", I suspected that circular recursion is not supported. (which is why I did't start by providing lots of details). Since it should be supported, It's probably me... 🙂 I will simplify my code and figure out if I can get my code to work or fail even with a more trivial case. If I can't get it to work I'll ask again for some guidance (and provide all the relevant details). Thanks! Michael