Skip to content

Commit 7796b06

Browse files
committed
Improve isActive query comparison
1 parent 3cc2e30 commit 7796b06

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

modules/isActive.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { matchPattern } from './PatternUtils'
2-
2+
import deepEqual from 'deep-equal'
33
/**
44
* Returns true if the given pathname matches the active pathname.
55
*/
@@ -64,11 +64,7 @@ function queryIsActive(query, activeQuery) {
6464
if (query == null)
6565
return true
6666

67-
for (const p in query)
68-
if (query.hasOwnProperty(p) && String(query[p]) !== String(activeQuery[p]))
69-
return false
70-
71-
return true
67+
return deepEqual(query, activeQuery)
7268
}
7369

7470
/**

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
],
2626
"license": "MIT",
2727
"dependencies": {
28+
"deep-equal": "^1.0.0",
2829
"history": "1.12.1",
2930
"invariant": "^2.0.0",
3031
"warning": "^2.0.0"

0 commit comments

Comments
 (0)