kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 194 forks source link

[question] How to redirect in an action (with FlowRouter.go)? #453

Closed trusktr closed 8 years ago

trusktr commented 8 years ago

Is it possible to redirect in an action? I know I can use FlowRouter.go, but by default it doesn't remove the previous location from the history, like a "redirect" does. Is there an option to pass to the go function to treat it like a redirect so it erases the previous history item?

trusktr commented 8 years ago

The reason I'm redirecting in the action is because I'm using async/await in there, and I might need to redirect a few ticks later, and it's a good balance: triggers for sync control of the route, and async in the action using async CSP communication between the action and the UI.

trusktr commented 8 years ago

By the way, the action function itself is not async, it just calls async functions inside, so the router itself is never blocked.

arunoda commented 8 years ago

You could use this I think: https://github.com/kadirahq/flow-router#flowrouterwithreplacestatefn

trusktr commented 8 years ago

:+1: