Fork me on GitHub
#fulcro
<
2021-12-03
>
roklenarcic15:12:17

Not really Fulcro thing but an interesting use-case I’ve got: I tried to use EQL (like queries) to describe updates to a normalized DB-like map by trees and I found the join format quite limiting… it’s not easy to specify any extra info like cardinality of join or which data structure to use for join property (e.g. to use set instead of vector for to-many join). I see many things around EQL being done with meta on it, which is brittle. I wonder if people ever considered a different format.

tony.kay16:12:34

joins can have arbitrary parameters

tony.kay16:12:54

{(:join key {:x 1}) [:subquery]}

tony.kay16:12:13

however, the example you provide have nothing to do with the query. Those a schema, which the query cannot, by definition, actually define. So, it makes no sense to say them in the query. This is why RAD has you declare attributes with extra info on them, so that data is available to utilities outside of query

tony.kay16:12:21

That is how, for example, the Datomic RAD plugin is able to do any arbitrary save from a simple normalized diff. The attributes say everything there is to know about themselves in the model.

tony.kay16:12:44

(where they can live, which database they are meant to be persisted in, uniqueness, validation, etc.)

tony.kay16:12:01

a to-many is only set-compatible if the database itself defines some kind of uniqueness constraint. Having data returned in a vector that happens to be distinct is an application level concern that is easily addressed by the receiver of the result, and need not be complected into the query language itself. The parameter support allows the query to add parameters, as I said, so it is possible to send information to an arbitrary query engine that is only appropriate to handle there, such as limit, offset, etc. Though many (not all) of those are also better handled by the client since there is no reason to add burden to a centralized resource (your database) that a distributed resource (the client) could do instead (on their dime)

tony.kay16:12:56

But as a pure “extra info” desire: parameters in EQL answer the need quite nicely.

xceno19:12:09

Another heads up from me (sorry :D) https://github.com/fulcrologic/fulcro-rad/blob/develop/src/main/com/fulcrologic/rad/pathom_common.clj#L7 breaks compilation if only pathom3 exists on the classpath. Pathom3 doesn't have the common.async-clj ns anymore. I just cleaned up my classpath and some deps aliases for the first time since forever and this bit me.

roklenarcic21:12:28

How do you access functions on a react class? https://github.com/JodusNodus/react-qr-reader/blob/master/src/index.js#L61 I imported this class as QrReader and I don’t know how to access this function. I also tried to call it on an element created by a component factory

Jakub Holý (HolyJak)14:12:20

you mean on a class or an instance?

Jakub Holý (HolyJak)15:12:30

Not sure how I would do that in JS actually. This provides an example impl https://www.fabiofranchino.com/blog/call-child-method-from-parent-rect-component/ , i.e. via getting a ref to the child. Perhaps the same can work here? Another one https://chafikgharbi.com/react-call-child-method/ also uses ref