emberjs / emberjs/ember.js

Error with RouterService.isActive with Query Parameters

Open
#17,423 9 comments 4 reactions 0 assignees View on GitHub
Has Reproduction Routing
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

When working with the RouterService's `isActive` method default query params and non-included query params are not accounted for properly.
As a user the expected behavior would be that `isActive` matches the `active` state of `link-to`.

This can be seen in this twiddle:

https://ember-twiddle.com/bad1dd32c81f9c4d93864cd0a59e19ac/77a1ab275385a99cdf156bf90704abed2e144c72?openFiles=controllers.application.js%2C

From digging into (and trying to modify tests in the Ember source) it looks like there is a false positive in the tests because of the way that `locationType: 'none'` handles QP default values.

In our application I'm able to get `isActive` to return true if `locationType` is set to none, but when using `hash` or `history` the value of `isActive` does not work for default values or if there are other QPs which are set to default.

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.