Fork me on GitHub
#reitit
<
2023-02-14
>
hifumi12306:02:37

It turns out my earlier statement about :on-coercion-error was wrong. Upon closer inspection of source code, it’s indeed possible to pass this option to reitit.frontend.easy/start!, but now I’m stuck trying to navigate to an error page when a coercion error happens. The coercion error handler is given a match and error object, but (r.f.e/replace-state ::error-route nil nil) doesn’t have any effect, and I notice that the atom r.f.e/history contains a null value. Any tips for achieving what I want?

hifumi12307:02:20

OK so I have made two observations: • when the coercion error happens on router initialization, there is no Html5History object yet, so on-coercion-error cannot just call r.f.e/replace-state • we can manually (.replaceState js/window.history …) then re-attempt initialization when the above happens My solution feels more like a hack, however. If there is a better way, please let me know