question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using stop() still changes the URL to the next path

See original GitHub issue

When 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jasongrishkoffcommented, Apr 27, 2019

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.

0reactions
dr-dimitrucommented, Apr 27, 2019

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found