Skip to content

transitionTo returns if path is the same #1186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
leishman opened this issue May 13, 2015 · 3 comments
Closed

transitionTo returns if path is the same #1186

leishman opened this issue May 13, 2015 · 3 comments

Comments

@leishman
Copy link

If the path does not change when calling transitionTo, the dispatch method does not fire. For me this is not the ideal behavior because it is causing problems for my app. If user clicks a link that is equal to their current path, then shouldn't this event still fire? If not, there is no way to easily capture this behavior and do something with it. Any thoughts? Am I missing something?

In createRouter.js:

      dispatch: function (path, action) {
        Router.cancelPendingTransition();

        var prevPath = state.path;
        var isRefreshing = action == null;

        if (prevPath === path && !isRefreshing)
          return; // Nothing to do!
@leishman
Copy link
Author

If I comment out the return in the conditonal, everything works as I would have expected.

@ryanflorence
Copy link
Member

I believe #1031 tries to fix this, please follow there, or let me know if I'm wrong and we'll reopen this.

@leishman
Copy link
Author

@ryanflorence That looks good to me. Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants