I don't know if that's a bug or rather a missing feature, but still, here is what I had to do to update the document title on route navigation:
m.route(document.querySelector('..'), '/', {
'/:provider': {
controller: function () {
// wait for the previous page to be added to the history
// and only after that update the page title to the current item
var timeout = setInterval(() => {
if (location.hash.replace('#/', '') === m.route.param('provider')) {
clearInterval(timeout)
document.title = 'Grant - ' + m.route.param('provider')
}
}, 100)
return {
onunload: () => clearInterval(timeout)
}
}
}
})
because the computePostRedrawHook is not exposed.
I though it would be great if there is a more elegant way to deal with this case, and I don't think updating the document title is an edge case either :)
Have you looked at new rewrite router version? It has significant changes and your case can be solved. Example: https://jsfiddle.net/Lngbakt3/2/
With the rewrite router in its current state, you could use the onmatch hook to set the title only when the route is set.
Good to know that this is taken into consideration in the rewrite, however I'm still going to wait a little bit more before switching to it.
Closing, as we are no longer accepting feature requests for 0.2.x.
Most helpful comment
Have you looked at new rewrite router version? It has significant changes and your case can be solved. Example: https://jsfiddle.net/Lngbakt3/2/