Fork me on GitHub
#fulcro
<
2022-05-16
>
pedro.leme02:05:00

Hi everyone, looking at the routing and history system of fulcro-rad I noticed that, when clicking in a link with a rr/route-to!, the browser history change happens in the com.fulcrologic.rad.routing.route-to! function, before the call to com.fulcrologic.fulcro.routing.dynamic-routing.change-route!. So, if the dr/change-route! function cannot change the route, the browser history state and the internal routing state will not match, i.e. the view displayed will be the old one but the route showed in the browser address bar will be the denied route. There is the dr/can-change-route? function but it does not take into account the :route-denied function possibly supplied in a component, so if we use it to decide whether to change or not the history before calling the rr/route-to! function we would lose the possibility to have an override of that decision. This, indeed, currently happens in the com.fulcrologic.rad.routing.history.install-route-history!, as when trying to change the route via the backward button in the browser the function will only check the com.fulcrologic.fulcro.routing.dynamic-routing.can-change-route?, so if it returns false then the function will refuse to change the route without even trying the :route-denied function. This analysis came from trying to understand why a link with rr/route-to! and the history backward button showed different behaviours in regards to trying to leave a dirty form in the fulcro-rad-demo app after adding a ::form/confirm function to it. Are these behaviours as intended?

❤️ 3
tony.kay03:05:34

Not intended. You've found a legitimate bug

pedro.leme01:05:12

thanks, how should I proceed? Can I reopen https://github.com/fulcrologic/fulcro-rad/issues/90 to keep track of and start working on it?

tony.kay01:05:56

yeah, that’s fine

👍 1
roklenarcic12:05:22

If I have a report and a column is expensive to load, and I want to load it async after report is shown (or perhaps when user clicks on a button), how would I go about doing that. Load report, then use dynamic queries to add a property to component query, load again?

tony.kay17:05:19

I assume you mean in RAD. This question has been asked before and answered in channel…let me see if I can find it

roklenarcic17:05:51

Thank you I will look at it

tony.kay19:05:03

You might even ask Gene…I think we worked together on a soln for him and his thing might be OSS

souenzzo19:05:55

I'm trying to use ":post-mutation `dr/target-ready!" in a df/load inside a will-enter function, but it throws an error like this: [com.fulcrologic.fulcro.mutations:226] - Unknown app state mutation. Have you required the file with your mutations? com.fulcrologic.fulcro.routing.dynamic-routing/target-ready! See

1
Björn Ebbinghaus19:05:54

Remove the ! There is the mutation target-ready and a function target-ready!

👌 1
❤️ 1
souenzzo20:05:44

working. thank you @U4VT24ZM3