swipely / aviator

Aviator is a single-page front-end router built for modularity.
MIT License
143 stars 6 forks source link

Odd corner case where query string raises an error with push state disabled #57

Closed nicolashery closed 10 years ago

nicolashery commented 10 years ago

Given this code:

var Handler = {
  index: function(req) {
    console.log(req);
  }
};

Aviator.pushStateEnabled = false;

Aviator.setRoutes({
  '/users': {
    target: Handler,
    '/': 'index'
  },
  '/cats/:id': {
    target: Handler,
    '/': 'index'
  }
});

Aviator.dispatch();

Aviator.navigate('/users?foo=bar');

I get a Uncaught TypeError: Cannot read property 'indexOf' of undefined (aviator.js:898).

But if I comment out the pushStateEnabled = false, it works as expected.

hojberg commented 10 years ago

I think i have an idea of whats going on here. Should have a fix shortly