feat(router): dont reuse the component if the params are different

This matches v3 functionality
This commit is contained in:
mhartington
2018-04-11 14:43:00 -04:00
committed by Manu MA
parent 54d7a12bea
commit 5899b0392d
3 changed files with 52 additions and 0 deletions

View File

@ -12,3 +12,24 @@ export function ensureElementInBody(elementName: string) {
}
return element as HTMLStencilElement;
}
export function objectValues(obj: any): any[] {
return Object.keys(obj).map(key => obj[key]);
}
export function deepEqual(x: any, y: any) {
if (x === y) {
return true;
} else if (typeof x === 'object' && x != null && (typeof y === 'object' && y != null)) {
if (Object.keys(x).length !== Object.keys(y).length) return false;
for (const prop in x) {
if (y.hasOwnProperty(prop)) {
if (!deepEqual(x[prop], y[prop])) return false;
} else return false;
}
return true;
} else return false;
}