This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-23
Channels
- # announcements (26)
- # babashka (8)
- # babashka-sci-dev (3)
- # beginners (93)
- # biff (44)
- # calva (1)
- # cider (7)
- # clj-kondo (13)
- # cljdoc (1)
- # clojure (121)
- # clojure-australia (2)
- # clojure-europe (18)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (1)
- # clojurescript (35)
- # conjure (1)
- # core-async (2)
- # datalevin (6)
- # datomic (28)
- # emacs (25)
- # events (1)
- # fulcro (5)
- # introduce-yourself (2)
- # jobs (8)
- # leiningen (2)
- # off-topic (13)
- # other-languages (1)
- # podcasts-discuss (1)
- # polylith (7)
- # rdf (6)
- # re-frame (1)
- # reagent (53)
- # releases (3)
- # rewrite-clj (7)
- # scittle (5)
- # shadow-cljs (63)
- # specter (1)
- # squint (5)
- # tools-build (5)
- # xtdb (7)
I have a Fulcro data modeling question:
What are people’s approach for modeling an entities that have different “types” but the same ident. I contrived example would be a “Vehicle” type, that might be a “Car” with car-like attributes, or a “Truck” with “truck” attributes (and some overlaps), but the same vehicle/id
ident
I know Fulcro has Union queries, but these require the idents of the components to be unique.
In the example I gave above, it might be worth changing the idents to be unique, but frequently that feels like the wrong choice in my actual data model, and I find myself having to make some mega query thats the union of everything i might be constructing, and a lot of custom logic to reset attributes when changing “types” in forms, etc.
Am I just modeling these things wrong and should be aiming for unique idents?
I don't think there's a single best answer for this. The features you have in EQL are unions and recursive queries. The tools you have in rendering are the entire language. If you're getting a collection of disparate types then unions can work, but that does potentially introduce aliasing on your id keys which is a pain. You can also just include all possible attributes in one normal query and include a type field and then do rendering with a multi method or something.
Thanks Tony! Helpful to know there’s no silver bullet I’ve been missing out on 😅 Happy Holidays!