emberjs / emberjs/ember.js

[Bug] URL does not reflect value of query param on controller -- consequtive transitions maybe have undefined behavior?

Open
#19,037 0 comments 0 reactions 0 assignees View on GitHub
Routing
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

### 🐞 Describe the Bug
URL does not reflect query param values in controller

### 🔬 Minimal Reproduction
https://ember-twiddle.com/ae19ae66f86bec9226f16816b067212c?openFiles=controllers.application%5C.js%2C

Click `Test` button.
The following transitions are executed:
```js
this.router.transitionTo({ queryParams: { foo: 123 } });
this.router.transitionTo('foo');
this.router.transitionTo({ queryParams: { foo: 1234 } });
this.router.transitionTo({ queryParams: { foo: 12345 } });
```
1. The first time you click `Test`, the URL is `/foo?foo=12345`, as you'd maybe expect, but
2. if you click `Test` a second time, the URL is `/foo?foo=123` and the `foo` implicit property on the application controller still has a value of `12345`

If there is no route transition, only a queryParams transition, then the second (2) behavior is consistent / happens on every click of `Test` -- so it appears that this is an issue with queryParam only transitions on the same route

### 😕 Actual Behavior
Described above

### 🤔 Expected Behavior
Behavior is consistent

### 🌍 Environment

- Ember: - 3.18.1
- Node.js/npm: - 🤷
- OS: - Windows 10
- Browser: - FireFox

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.