Fork me on GitHub
#fulcro
<
2022-11-01
>
cjsauer15:11:47

Separate question from the above, how does one get around circular references when using the raw nc function? Using declare doesn't seem to play nice when reloading the namespace in the REPL.

cjsauer15:11:20

Trying to use :componentName to register the class in the registry but even that is evaluation order dependent...

cjsauer15:11:28

To clarify, I have two entities that reference each other. A has a reference to B, and B can also references entities of type A. There is a circular recursion example in the docs but it isn't mutually recursive like this...

tony.kay18:11:46

The recursion notation is useful for self-recursion, but mutual recursion just isn’t possible in the REPL or regular code without specifically spelling out N different things. I think if you give the concrete details of your example perhaps we can suggest a better approach.

tony.kay18:11:09

The only code I’ve ever seen that tried to do this was something where the author was trying to generate a DOM in Fulcro. E.g. they wanted a Div defsc, which then might contain a P, etc. It was a complete mess, and of course mutually recursive in all sorts of crazy ways. The simple solution was that the defsc was for a Node, and the query included the “type”. Then worked fine.

cjsauer18:11:12

Yea I think I can actually model my problem in a way that causes the two entities to collapse into a single entity. This actually results in a cleaner model overall.

❤️ 1
PB20:11:24

Can anybody help me out?

(datomic/start-databases
   [{:com.fulcrologic.rad.attributes/identities #{:constraint/id},
     :com.fulcrologic.rad.attributes/schema :production,
     :com.fulcrologic.rad.attributes/type :symbol,
     :com.fulcrologic.rad.attributes/qualified-key :constraint/field}]
   config)
Gives me the error message Validation Failed However
(datomic/start-databases
   [{:com.fulcrologic.rad.attributes/identities #{:constraint/id},
     :com.fulcrologic.rad.attributes/schema :some-random-schema < LOOK AT ME
     :com.fulcrologic.rad.attributes/type :symbol,
     :com.fulcrologic.rad.attributes/qualified-key :constraint/field}]
   config)
This works It could be to do with the :com.fulcrologic.rad.attributes/type :symbol as this does work too:
(datomic/start-databases
   [{:com.fulcrologic.rad.attributes/identities #{:constraint/id},
     :com.fulcrologic.rad.attributes/schema :production,
     :com.fulcrologic.rad.attributes/type :string,
     :com.fulcrologic.rad.attributes/qualified-key :constraint/field}]
   config)

Jakub Holý (HolyJak)08:11:08

Is this in RAD Demo or your own project? I have not messed with this and do not know what datomic/start-databases is supposed to do but I know the demo works (most of the time?). Does the error include any details? E.g. in (ex-data <the error>) ?

PB18:11:46

@holyjak Sorry I missed your reply These are all the errors it gives. This is in the RAD demo.

Jakub Holý (HolyJak)18:11:02

So you have just vanilla RAD demo, run its (start) and get this error?

PB15:11:06

That's correct