"Route reuse" + looking for general advice

I’ve found the onUrlRequest / onUrlChange bifurcation in Browser.application to be really tedious to work with. It’s better than it was in 0.18, but still doesn’t feel natural to me. See more discussion in this thread:

Since that thread, I’ve completed updating elm-route-url to 0.19 (but it hasn’t been merged yet).

I’ve also built upon that to create a feature I call “anchor management”. I’ve been using it in my app for a while now and really like it.

The basic idea is that your view function gets a msg -> ... -> Html msg helper function that it can use to make <a/> elements that correspond to a msg in your app. These special <a/> elements that it creates interact with your update function much more cleanly, their target URLs are automatically generated using the other functions you’ve already provided to RouteUrl, etc. No more choosing the lesser evil between a href and div onClick. :slight_smile:

Unfortunately I haven’t had time to write documentation for it, so you’ll have to see what more you can gather from the code changes and my sandbox test code.

1 Like