Skip to content
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

Fix error when user clicks a link within 500ms #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cmwelsh
Copy link

@cmwelsh cmwelsh commented Jan 20, 2015

This Chrome "bug fix" can be removed now per #233. Chrome 39 is now in production and the "fix" has a big drawback of throwing an error if the user clicks a link within 500ms of director initialization.

Closes #233

@cmwelsh
Copy link
Author

cmwelsh commented Jan 26, 2015

As a note this caused #227 for me on iOS but I work around that by tracking the last matched route & parameters combination...

@tecnobrat
Copy link

Can we get some eyes on this?

@tecnobrat
Copy link

I'm experiencing the side effect of the original "fix", which is the fact that if you call setRoute within 500ms, it causes an error.

@asafyish
Copy link

asafyish commented Oct 8, 2015

Can it be merged ? the tests are failing on missing npm packages, not real tests.

@rdy
Copy link

rdy commented Nov 28, 2015

+1 to get this fix merged into master, chrome has long since fixed this issue.

@rohan-deshpande
Copy link

@cmwelsh do you mind posting your workaround for iOS? I may move to react-router like you have soon but it's going to be a bit of work and I'd prefer a workaround for now see #312 for what I've done already.

@X13454
Copy link

X13454 commented Jan 31, 2016

+1. As long as there is no fix, someone has a workaround for this?

@statianzo
Copy link

We started bumping into this today. Can this get pulled in @jcrugzz?

@Gahen
Copy link

Gahen commented Apr 25, 2016

+1 please merge this.

@iammerrick
Copy link

@3rd-Eden @bmeck @dscape @gangstead @indexzero @jcrugzz @Swaagie Can we please get this merged? It's a one liner and is causing production issues for us, would love to not have to point to a fork.

@krasimir
Copy link

krasimir commented Jun 28, 2016

Well, there is a workaround and that's a function waiting for onpopstate to be populated. It's hacky and it's not working in every use case.

navigate: function (route) {
  var isDirectorReady = callback => {
    var interval;

    if (window.onpopstate !== null) {
      callback();
      return;
    }
    interval = setInterval(function () {
      if (window.onpopstate !== null) {
        callback();
        clearInterval(interval);
      }
    }, 100);
  }

  isDirectorReady(() => {
    this._router.setRoute(...);
  });
}

So, I'm definitely +1 for merging this PR.

setTimeout(function() {
window.onpopstate = onchange;
}, 500);
window.onpopstate = onchange;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cmwelsh could you please please review this?

@gkatsanos
Copy link

@trevordmiller it seems like it :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chrome fixed routing bug