From 4e6e554d3c1d3a47f9e9219ae94468f4f4979154 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Mon, 15 Feb 2021 21:47:33 +0100 Subject: [PATCH] Don't use sparse arrays because they aren't currently supported in QS --- lib/core/src/client/preview/parseArgsParam.ts | 1 - lib/router/src/utils.ts | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/core/src/client/preview/parseArgsParam.ts b/lib/core/src/client/preview/parseArgsParam.ts index 09ab841be010..f5418fc5a474 100644 --- a/lib/core/src/client/preview/parseArgsParam.ts +++ b/lib/core/src/client/preview/parseArgsParam.ts @@ -15,7 +15,6 @@ const validateArgs = (key = '', value: any = ''): boolean => { const QS_OPTIONS = { delimiter: ';', // we're parsing a single query param allowDots: true, // objects are encoded using dot notation - allowSparse: true, // arrays will be merged on top of their initial value }; export const parseArgsParam = (argsString: string): Args => { const parts = argsString.split(';').map((part) => part.replace('=', '~').replace(':', '=')); diff --git a/lib/router/src/utils.ts b/lib/router/src/utils.ts index 65bd0dcb0191..8c810ccbbdf2 100644 --- a/lib/router/src/utils.ts +++ b/lib/router/src/utils.ts @@ -40,10 +40,7 @@ interface Args { const deepDiff = (value: any, update: any): any => { if (deepEqual(value, update)) return undefined; if (typeof value !== typeof update) return update; - if (Array.isArray(value)) { - if (!Array.isArray(update)) return update; - return update.map((upd, index) => deepDiff(value[index], upd)); - } + if (Array.isArray(value)) return update; if (typeof update === 'object') { return Object.keys(update).reduce((acc, key) => { const diff = deepDiff(value[key], update[key]);