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

setParams() doesn't fully work when params being set trigger model refresh from route. #17

Open
camatangelo opened this issue May 11, 2016 · 2 comments

Comments

@camatangelo
Copy link

Not sure if this is more of an issue with Ember or not, but I'm trying to set multiple query params in a component with setParams(), however since both of these params trigger a model refresh on one of my routes, the model hook fires as soon as the first param is changed (in this case category) and does not set any params after it (in this case name).

// component
this.get('paramsRelay').setParams({
  category: '',
  name:     ''
});
// route
export default Route.extend(AutosubscribeMixin, {

  queryParams: {
    category: {
      refreshModel: true
    },
    name: {
      refreshModel: true
    }
  },      

  model(params) {
    // ...
    // fires as soon as category is changed
  }

 // ...
@camatangelo camatangelo changed the title setParams() doesn setParams() doesn't fully work when params being set trigger model refresh from route. May 11, 2016
@knownasilya
Copy link
Owner

knownasilya commented May 11, 2016

Agreed. Not sure there is a nice solution for this at the moment. cc @rwjblue @raytiley

I think the alternative would be to use transitionTo({ queryParams: { ... } }).

@jbourassa
Copy link

FWIW, the model hook can also be called twice when navigating using link-to, or at least that's what happens in this trimmed down example app (see console logs)

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

3 participants