Remove the hash event listener before reloading the page, as the reload was being swallowed by our router. Along the way, refactor out routing logic form app.tsx to avoid causing a circular import.