`setParams()` doesn't fully work when params being set trigger model refresh from route.
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
}
// ...
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: { ... } }).
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)