Fork me on GitHub
#fulcro
<
2023-02-13
>
donavan10:02:55

HI all, can I ask for a quick sanity check as we’re dealing with a bug in our code that manifests during tests but not in the browser; is it valid to call com.fulcrologic.rad.routing/route-to! within a deferred route? We have a deferred route that issues a load, if the server indicates that the entity is inaccessible we change the route before and without calling route-ready!. This works in the browser but fails in our test suite. We upgraded Fulcro from 3.5.24 -> 3.6.0 which didn’t exhibit the bug but upgrading RAD 1.1.0-RC4 -> 1.4.5 (and in fact a few versions we tested beyond 1.1.0-RC4 also surfaced the bug)

tony.kay18:02:26

Routing is done through transactions, which are async, and may not test well. Route deferral is really meant for I/O and not decision-making. I would recommend writing your own decision logic outside of routing, and put your I/O there if you have decision logic. Don’t use routing as a general-purpose logic tool.

tony.kay15:02:01

And yes, you can change your mind on a route mid-stream. That’s not a problem.