Emitting pushState is a no-op in a route handler
Author: aknuds1Created Feb 21, 2018Updated Jun 13, 2018
Expected behavior
In choo v6.8.0, emitting pushState (e.g. emit('pushState', '/')) in a route handler should have the documented behaviour of navigating to the indicated page.
My use case is to redirect the user to the homepage from f.ex. the login page if the user is already logged in.
Actual behavior
When emitting this event in a route handler, it appears to do nothing. Instead I defer the event to be emitted asynchronously, which makes it work: setTimeout(() => {emit.global('pushState', '/')}, 0)
Steps to reproduce behavior
Emit the pushState event in a route handler, in my experience it'll be a no-op:
emit('pushState', '/')Source: choojs/choo