From d6546d9e388a40b8200c77c0394fc8c8ddf60dac Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 6 Aug 2020 10:12:58 +0200 Subject: [PATCH] fix(router): properly check null and undefined in isSameRoute --- src/util/query.js | 2 +- src/util/route.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/query.js b/src/util/query.js index c017f2b5d..c56cfcad5 100644 --- a/src/util/query.js +++ b/src/util/query.js @@ -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 { const res = {} diff --git a/src/util/route.js b/src/util/route.js index 54a91a738..6b049ccc2 100644 --- a/src/util/route.js +++ b/src/util/route.js @@ -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)