[Bug] Route.refresh() persists old queryParams values after programmatic updates
- Dominant language
- TypeScript
- Stars
- 22.6k
- Forks
- 4.2k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 15
Description
### 🐞 Describe the Bug
Calling `refresh()` on a route after updating queryParams results in the old queryParams values persisting and the new values being lost. This behavior is necessary to work for the scenario where you want a query param to have `refreshModel: false` and only execute the model hooks when `refresh()` is called programmatically.
### 🔬 Minimal Reproduction
Describe steps to reproduce. If possible, please, share a link with a minimal reproduction.
1) Add a query param to a route
2) Programmatically change the value of that query param on the controller
3) Immediately call `refresh()` on the route
https://ember-twiddle.com/c43e0da2ee0078f148ad492e6c43c44e?openFiles=routes.my-route%5C.js%2C
### 😕 Actual Behavior
As you can see from the twiddle above, there are three scenarios we care about here:
1) The query param is defined with `refreshModel: true` and the value is updated via controller. The model hook executes and the value is correct.
2) Same as scenario 1, but calling `refresh()` immediately after updated the value. The model hook executes and the value is **incorrect**.
3) Same as scenario 2, but the query param is defined with `refreshModel: false`. The model hook executes and the value is **incorrect**.
### 🤔 Expected Behavior
In all three scenarios, the same behavior should result - the query param should be updated and the new value should be available when the model hook executes.
### 🌍 Environment
- Ember: - We first started seeing this behavior change introduced when upgrading from Ember 3.12 to 3.16. It worked as expected in 3.12 but is now broken in 3.16+
- Node.js/npm: - 12.13
- OS: - macOS 10.15.7
- Browser: - Chrome
### ➕ Additional Context
Add any other context about the problem here.
Contributor guide
Assessment
This issue has not been assessed yet.