Using stop() still changes the URL to the next path
See original GitHub issueWhen firing stop()
inside of the global triggers.exit
, the expected behavior is that the user is not taken to the next route. From what I can see, FlowRouter still updates all its internals to reflect that we’re on the new route, even though the page doesn’t actually change.
FlowRouter.triggers.exit([pageChange])
pageChange = function(context,redirect,stop) {
if (context.path.indexOf('step=') > -1
&& !confirm('Are you sure you want to leave this page?'
+ ' You haven\'t finished yet.')
) {
stop()
}
}
This guy seems to have had a similar problem and solved it, but the pull request was never merged? https://github.com/kadirahq/flow-router/pull/681
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Change the URL in the browser without loading the new ...
Only reliable way to change the url without changing pages is to use an internal link or hash. e.g.: http://site.com/page.html becomes ...
Read more >History.pushState() - Web APIs | MDN
Note that pushState() never causes a hashchange event to be fired, even if the new URL differs from the old URL only in...
Read more >Control when external references (links) are updated
You can control when and how external references (to other files or databases) in your workbook are updated by changing some Excel settings....
Read more >Strict Mode
StrictMode currently helps with: Identifying components with unsafe lifecycles; Warning about legacy string ref API usage; Warning about deprecated findDOMNode ...
Read more >YouTube Embedded Players and Player Parameters
Overview. This document explains how to embed a YouTube player in your application and also defines the parameters that are available in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To me, “stop” would imply that I want to cancel my routing and stay where I am. The fact that it only fires after the URI has changed seems wrong. I’ve already used a workaround, so in a sense this is solved.
@jasongrishkoff thank you.
We did additional checking, there is no easy way (or at least we haven’t found any) to change this behavior, this part remained unchanged from original flow router.