Fork me on GitHub
#fulcro
<
2022-11-23
>
tony.kay15:11:52

New RAD releases. See #C015AL9QYH1

👀 5
Tyler Nisonoff21:11:31

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?

tony.kay03:11:18

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.

tony.kay03:11:53

Then your idents can all be vehicle id or something

Tyler Nisonoff12:11:38

Thanks Tony! Helpful to know there’s no silver bullet I’ve been missing out on 😅 Happy Holidays!