Fork me on GitHub
#fulcro
<
2024-01-14
>
Jakub Holý (HolyJak)21:01:47

@tony.kay I am looking into some false-positives in https://github.com/holyjak/fulcro-troubleshooting and would like to understand why the rad-demo’s LandingComponent has nil parent (i.e. :props :fulcro$parent ) even though it is under a router, which itself is under Root. (It causes me to mis-identify this component as the root one.) Is there some more reliable way to distinguish a root component (which should have nil ident) from a child one?🙏

tony.kay17:01:39

Hm. I think that is in the raw props, not the fulcro props. Try looking at

(this-as this
  (.-props this))

tony.kay17:01:27

I probably have a helper fn for that…don’t rmember the name..`raw-props` or something. There is also a comp/parent helper isn’t there?

Jakub Holý (HolyJak)16:01:32

The .-props contain nothing useful of the LandingPage component (`C`) - see pic below. I get (comp/get-parent C) => nil , because (comp/isoget-in C [:props :fulcro$parent]) == nil (which is what get-parent calls). (Where C is (def C (comp/class->any com.example.client/app LandingPage)) )

Jakub Holý (HolyJak)20:01:19

When I try com.fulcrologic.fulcro.cards.nested-dynamic-routing-tree-cards then the router’s target has a parent, but LandingPage in rad-demo does not 🤯 But the router there has a parent.

Jakub Holý (HolyJak)20:01:10

Found it, kind of: when the target component has :use-hooks? true then it ends up with nil parent (i.e. (comp/get-parent this) call inside its body returns nil)

tony.kay21:01:59

ah, I was going to suggest something like that

tony.kay21:01:22

you can report it as an issue and try to patch it if you want

tony.kay21:01:26

I’m busy for a while