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

Ember 2.16 router service unable to transition without all query parameters present #15725

Closed
pgrippi opened this issue Oct 10, 2017 · 3 comments

Comments

@pgrippi
Copy link

pgrippi commented Oct 10, 2017

I upgraded my app from 2.15 to 2.16 today and I think I've found a bug with the transitionTo method in the new routing service.

In 2.15 I was using the ember-router-service-polyfill addon that I have since removed. The following code was working fine but now appears to be broken:

// controller
import Controller from '@ember/controller';

export default Controller.extend({
  queryParams: ['page', 'message'],
  page: 1,
  message: ''
});

// component
import Component from '@ember/component';
import { inject as service } from '@ember/service';

export default Component.extend({
  router: service(),

  actions: {
    jump() {
      let queryParams = { message: 'hello world!' };
      this.get('router').transitionTo('index', { queryParams });
    }
  }
});

The error I get in the jump action is: "You passed the false query parameter during a transition into index, please update to page", which I've narrowed down to be coming from this line in router.js.

It does end up working if I include both message and page in the query params hash. In short:

// broken
this.get('router').transitionTo('index', { queryParams: { message: '' } });
this.get('router').transitionTo('index', { queryParams: { page: 1 } });
this.get('router').transitionTo('index');

// works
this.get('router').transitionTo('index', { queryParams: { message: '', page: 1 } });

I have created this app that shows the broken behavior: https://github.com/pgrippi/ember-216-routing-service-bug

@pgrippi pgrippi changed the title Ember 2.16 router service unable to route without all query parameters present Ember 2.16 router service unable to transition without all query parameters present Oct 10, 2017
@hellobrett
Copy link

We are also being affected by this issue. Any chance for a patch release?

@sly7-7
Copy link
Contributor

sly7-7 commented Oct 11, 2017

@hellobrett seems like there will be soon one: #15613 (comment)

@rwjblue maybe we can close this issue ?

@rwjblue rwjblue closed this as completed Oct 11, 2017
@rwjblue
Copy link
Member

rwjblue commented Oct 11, 2017

Thanks @sly7-7!

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

No branches or pull requests

4 participants