Fork me on GitHub
Jakub Holý (HolyJak)11:03:48

@tony.kay I am analyzing an interesting problem where a I route to a leaf but the dynamic router target's render function does not see its route-segment when it calls and prints (dr/current-route app) - the route only contains the parent router's route (I have 2 nested routers). When I force re-render the app, the full route is visible. I narrowed it down to the fact that on the first render (comp/class->registry-key NestedRouter) returns false. That is weird because obviously it is mounted in the page since its child is being rendered, no? Could it be simply because re-indexing has not run yet and thus the registry is not updated about the current state of the world? Thank you! /cc @jj974


So this is a know weakness of current-route, which I thought was documented in the docstring. It requires the component in question be mounted before it can return the correct value. This is because it is possible (due to composition) to have more than one “leaf” on screen at once from a data perspective (e.g. just scanning the query could lead you to a case where any of a set of things could be on-screen). So, that function checks to see what is actually on-screen.

👍 1

I wrote an alternative somewhere I thought that uses the data model…maybe in RAD? Let me look 👀

🙏 1
Jakub Holý (HolyJak)19:03:12

Thank you! I understand that and it makes sense. But the thing is that it is mounted - I am logging the route in the target's render. That is what surprised me. So my hypothesis is that it is simply because the index has not been updated yet (reindexing runs after target - ready) so it is mounted but Fulcro doesn't know yet.


Probably true. There is an active target function in rad routing that doesn't use index


On phone now so don't have exact link

👍 1

Hey. I was reading through the book and now it says that I can use by-id if the keyword is id. Is this a typo or do I prepend by- to make the entity id? I'm questioning it since it seems like something that would get an explicit mention but I don't see an explanation.


Would :person/id still work or it must me :person/by-id? Thanks!


Don't bother with by- ... Just old naming advice


Ok, thanks!