Fork me on GitHub
#fulcro
<
2020-07-03
>
Wilson Velez00:07:52

hi, I’m following the videos to learn fulcro 3.0, right now I’ve just finished the video 5: how rendering works

Wilson Velez00:07:27

I downloaded the code for the tag

Wilson Velez00:07:55

and when I tested it with the fulcro version in the example it works as in the video

Wilson Velez00:07:35

but if I upgrade the fulcro version the rendering is “broken” and now it render all the “parents”

holyjak06:07:29

The default renderer has been changed so that could explain it. It is now the multiple-roots-renderer , which mostly behaves just like the old keyframe-render . Perhaps the older Fulcro version uses the ident-optimized-render , which only renders components with changed data, based on their ident. This has better performance but leads to rendering troubles when Fulcro cannot figure out some dependencies (and does does not re-render something you want it to). For most cases, the multiroot is good enough and simpler.

✔️ 1
Wilson Velez00:07:56

is this something expected from this new versions?

holyjak07:07:17

@tony.kay regarding the :pre-merge example in http://book.fulcrologic.com/#_initial_state_2 - I like it simplicity but it turns out that if only works if (1) either you use :ui/* for the router property or (2) you make sure to omit Fulcro's not-found from the data tree (otherwise you end up with :my/router :com.fulcrologic.fulcro.algorithms.merge/not-found in the data-tree, which overrides whatever is in the initial state). So perhaps it is better (i.e. less error-prone) to explicitly set the router state:

:pre-merge (fn [{:keys [data-tree]}]
             (assoc data-tree 
               :settings/panes-router 
               (comp/get-initial-state SettingPanesRouter))) 
What do you think? Should I send a PR for this?

zilti11:07:00

...ooh, I have to query for the :db/ident to get the keyword of an enum. 🙂

holyjak13:07:20

Hello, I am writing a post about possible approaches to error handling in Fulcro. Feedback would be most appreciated! https://gist.github.com/holyjak/a70947d6618c79279c68cc08f948603e @tony.kay I am encountering a Catch-22 problem here. I must add :pc/errorsto my queries (together with Pathom's p/raise-errors) yet I don't need/want to send it to the backend since Pathom would turn all into :p/not-found (and possibly later into actual error maps, if any). I assume I could remove them from the backend query via :global-eql-transfrom . Is this a correct approach? If so - why does RAD use this transform to add :pc/errors to the query ? Thank you!

zilti16:07:56

Is it possible to to a reverse lookup in a defsc query? What my situation is is I have a :notification/triggered-by that points to an :account/id. And I have a :company/primary-account that also points to :account/id. Now I want to, starting from having :notification/id, reach :company/id.

magra16:07:17

If you use datomic you can use :company/_primary-account.

zilti16:07:16

Hmm, I just tried that and got nothing... I guess I could just write a resolver for the reverse case

magra16:07:38

Your pathom resolver has to have a resolver for it.

magra16:07:05

It needs to be mentioned in ::pc/output and be queried.

magra16:07:35

I often replace :user/_company in the resolver with :company/user. That gives me readable backlinks in the normalized db.

zilti16:07:37

I am using Fulcro RAD Datomic, no idea if it does create reverse resolvers. Apparently not, because adding :company/_primary-account returned nothing. Hm. While we're at it, do you know if there's a way to make the ::pc/output being "or" instead of "and"? As in, when I give it #{:company/id :vendor/id} to name an example, that i mean either the first or the latter, instead of both

magra16:07:43

Hmm. Ich glaube Du fragst immer nach beiden und bekommst halt nicht zurück was er nicht findet. Im Output heißt das ja nur, dass er es Dir gibt, nicht, dass er es garantiert.

magra16:07:02

Das ist ein Set, kein AND.

magra16:07:22

Also ein Datomic Pull, kein Datomic Query.

zilti16:07:30

Nein, so wie ich das gesehen habe, benutzt Pathom einen Resolver nur dann, wenn es alles, was ins ::pc/input gehört, hat

zilti16:07:06

Interessanter Sprachenwechsel ^^

magra16:07:36

Jep. In Input schreibst Du Ding/id und im Output Ding/name, Ding/Adresse etc.

magra16:07:07

Ding/id muss er kennen. Und dann schaut er ober dir Ding/Name und Ding/Adresse geben kann.

magra16:07:21

Wenn Du die von Hand schreibst würdest Du ja einen Datomic Pull schreiben.

zilti16:07:31

Genau, aber es gibt wohl keine Möglichkeit, zu sagen, "als Input akzeptiere ich entweder a/id oder b/id"?

magra16:07:29

Das wären zwei Resolver.

magra16:07:47

Du kannst aber einen der beiden so klein schreiben, dass er zum anderen führt.

magra16:07:19

Ansonsten gibt es noch sowas wie "Alias" oder so ähnlich, wenn sich das eine aus dem anderen ableiten läßt.

zilti16:07:54

Hmm okay. Ja, dann gibt's halt mehr als einen 🙂 Danke!

magra16:07:59

Oder es werden drei Resolver, das gemeinsame in einem und zwei kleine, die zum großen überleiten.

zilti16:07:58

Ja, ich habe ein paar Attribute, die ich an mehrere verschiedene "Tabellen" anhängen kann, und ich dachte, ich könnte da vielleicht einen Resolver für alle schreiben ^^ Na, ist ja nicht viel Overhead.

magra17:07:04

Wenn man die Resolver möglichst klein schreibt wiederholt man sich nicht so oft.

magra17:07:43

Ist Geschmackssache.

tony.kay17:07:03

@holyjak I’m kinda busy for the next few days. Ping me again next week.

👍 1