[3.13] Query Params not updating when refreshing route
- Dominant language
- TypeScript
- Stars
- 22.6k
- Forks
- 4.2k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 15
Description
[Ember-twiddle with a simplified re-creation of the issue](https://ember-twiddle.com/8f72d9d1e1021abada5d6f230bdd9d1c?openFiles=controllers.application.js%2C&route=%2F%3FmyQueryParam%3Dtrue)
[github repo with a new ember app containing the same code](https://github.com/jrohrbaugh/query-params-bug-test)
We've been using the route's `refresh` method (documented [here](https://api.emberjs.com/ember/3.13/classes/Route/methods/refresh?anchor=refresh)) to reload the route's model. `refresh` gets called by a route action, which is in turn called by a controller action. The controller action modifies the value of a query param, which is then accessed via the route model hook's `params` argument.
We noticed a change in this pattern's behavior when upgrading from 3.12 to 3.13. The model hook is no longer picking up the updated query-param value; it's using the original value instead. Ember-twiddle doesn't support recent Ember versions, so the logs there are giving the expected result. I created a fresh app using the same code: it defaulted to 3.11 and I observed the expected result, then I upgraded to 3.13 and the result changed. See the difference in the query param's value here:

While debugging, I was able to get the expected behavior on 3.13 by wrapping the call to the `refreshRoute` action inside of a setTimeout of 0ms - going from
```
this.send('refreshRoute');
```
to
```
setTimeout(() => {
this.send('refreshRoute');
}, 0);
```
so this could possibly be a queuing issue?
Contributor guide
Assessment
This issue has not been assessed yet.