swipely / aviator

Aviator is a single-page front-end router built for modularity.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

nicolashery opened this issue · comments

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.

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