Skip to content

Commit

Permalink
fix(router): properly check null and undefined in isSameRoute
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Aug 6, 2020
1 parent b952573 commit d6546d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/query.js
Expand Up @@ -38,7 +38,7 @@ export function resolveQuery (
return parsedQuery
}

const castQueryParamValue = value => (value == null ? value : '' + value)
const castQueryParamValue = value => (value == null ? value : String(value))

function parseQuery (query: string): Dictionary<string> {
const res = {}
Expand Down
2 changes: 2 additions & 0 deletions src/util/route.js
Expand Up @@ -104,6 +104,8 @@ function isObjectEqual (a = {}, b = {}): boolean {
return aKeys.every(key => {
const aVal = a[key]
const bVal = b[key]
// query values can be null and undefined
if (aVal == null || bVal == null) return aVal === bVal
// check nested equality
if (typeof aVal === 'object' && typeof bVal === 'object') {
return isObjectEqual(aVal, bVal)
Expand Down

0 comments on commit d6546d9

Please sign in to comment.