yeah, filtering is fine if you want to code it 🙂
beware there are modes in there. Try to only affect the :runtime mode
Does the current-route! function mentioned at https://book.fulcrologic.com/#_route_segments_and_changing_routes exist? I don't see it in a github search. Thanks
I have a n00b question. I am working on Fulcro with React Native. I have the app rendering properly and am able to see controls.. I am successfully loading queries in to my local app db -- I can seee the data with Fulcro inspect. However, the forms on the simulator are blank and my debugging statements show that props are empty. I am sure that i missed something or am doing something wrong. Could someone point me in the right direction? Thanks in advance!
Use the source. Double-tap of shift in IntelliJ, type current-route, double tap shift again to get “include non-project items”:
Or just jump to source from a require of the DR ns
Or clone the repo and try git grep
Or use https://cljdoc.org/d/com.fulcrologic/fulcro/3.4.17/api/com.fulcrologic.fulcro.routing.dynamic-routing (thanks to @holyjak!!! So nice)
You have to join the loaded data to your view graph. Initial data composes it all together for what is there at app startup, but if you’re loading data you use targeting to create the edge in the UI. If props are nil, here is the way to diagnose it every time: 1. Go to DB Explorer tab in Inspec 2. Find your root data node 3. Follow the graph by clicking to follow your data graph in the same way your UI joins the target in…root through router current route through X , Y, etc. At some point you will either: Discover that your data graph isn’t connected and that you should have added :`target` to your load or merge, OR discover that you didn’t compose the query to match your data graph.
Thank you @tony.kay. I'm sorry to bother you.
no problem. Everyone asks this same question at some point, and it’s funny how silly simple the answer always is: Fulcro is the only lib I’m aware of where the View = F(state) in such a literal way. If the F, which is just the query, can follow the graph in state
, which it does literally by walking idents, then you’ll get the right props.
The one additional screw-up is if you don’t pull the props out and pass them to the child. That’s also a possible thing to look at, but much rarer mistake since the defsc macro tries to error-check your destructuring of props for typos (because it was a common error that we could detect and help with)
Thanks @tony.kay However, I'm asking about:
Additional useful functions are:
(current-route! component-or-app starting-component)
Returns a vector of the path components on the current (live) route starting at the given starting-component. If you use your root component it will be the absolute path, and using some other component router will give the relative path from there.
Note the trailing !
yes, that doc is incorrect
Thanks to my awesome mentees, I am starting a new series, "Fulcro Gotchas". The beginning is here: https://gist.github.com/holyjak/5bad02dc378fe57b3111edab42b4adbc If you have some pitfalls and misconceptions of your own that you would like help others to avoid, let me know!
Thank you, Tony! Updated.