Fork me on GitHub
#reagent
<
2022-05-11
>
johanatan19:05:02

can someone explain how to achieve the equivalent of reagent.core/component-path now that it's been removed (or to otherwise get a "stack trace" of the current component's lifecycle provenance)? Release notes for 0.10.0 mentioned: • Removed reagent.core/component-path. The implementation depended on internal React details and using just Component displayName achieves nearly the same but i'm not sure what is meant by "Component displayName" . Thanks in advance!

johanatan19:05:29

i want the component stack, not just the name

johanatan19:05:29

which is where reagent.core/component-path was born

p-himik19:05:59

I see. Nowadays error traces are generated by React itself and AFAIK there's no easy way of getting such a trace by yourself. Maybe React DevTools by itself would be enough for whatever issue you're trying to solve, or maybe its code will help - after all, it builds the whole component tree.

johanatan19:05:48

the error traces i'm getting from react aren't sufficient for whatever reason. i'm using reagent + re-frame so there's a lot of indirection there

p-himik19:05:19

Let me guess - it has something to do with deref'ing a subscription?

johanatan19:05:00

not this one. but almost every error of any sort is its own adventure lol

johanatan19:05:26

i found this: https://lilac.town/writing/modern-react-in-cljs-error-boundaries/ which helped somewhat. but it would be nice if it had the stack trace in it

p-himik19:05:48

Interesting, I usually don't have such problems. Can you post a minimal reproducible example where the reported error does not indicate where the actual source of the error is?

johanatan19:05:38

oh i get the actual source just fine. i just have no idea where it was called from since it is being rendered opaquely

johanatan19:05:58

the link between it and the rest of the component graph is broken

johanatan19:05:20

^^ for example, completely useless stack trace

johanatan19:05:03

^^ and another

p-himik19:05:38

Which version of Reagent are you using?

p-himik19:05:43

Try with 1.1.1.

johanatan19:05:06

lol my lucky day

johanatan19:05:27

ah yep. that worked

johanatan19:05:34

back to how i remember it being before

johanatan19:05:58

i guess there was a regression

johanatan19:05:04

during that interim

johanatan19:05:44

thank you for your help!

👍 1