[Bug] QueryParams get erroneously set when entering transition while there's an ongoing transition
- Dominant language
- TypeScript
- Stars
- 22.6k
- Forks
- 4.2k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 15
Description
### 🐞 Describe the Bug
I'm encountering some strange behaviour related to queryParams when starting a new transition while an ongoing transition is still loading.
Routes `child-a` and `child-b` both have the same queryParams. When `child-a` has its queryParams set and is mid-transition (because its model hook hasn't resolved yet), if you then navigate to `child-b`, the second route will have its queryParams erroneously populated. If you instead wait until `child-a`'s model hook has resolved before navigating to `child-b`, the queryParams won't get populated (as expected).
### 🔬 Minimal Reproduction
Repro repo: https://github.com/sergiofenoll/weird-qps
Repo is using v3.28.9, but I also tried with 4.4.2 and I encounter the same behaviour.
- Click on `Go to Child A`
- Observe that the `Go to Child B` link links to `/child-b` with no query params
- Click on the `Click me to change the value of the queryParams` button
- While the loading page is still visible (it takes 1 second for the model hook to resolve), click on `Go to Child B`
- Observe that the query parameters have been set to `foo=oof&bar=rab`
### 😕 Actual Behavior
The query parameters of `child-b` have been populated.
### 🤔 Expected Behavior
The query parameters of `child-b` shouldn't be populated, as they were never set to do so.
### 🌍 Environment
- Ember: 3.28.9, 4.4.2
- Node.js/npm: 16.15.1
- OS: Linux
- Browser: Firefox
### ➕ Additional Context
N/A
Contributor guide
Assessment
This issue has not been assessed yet.