From fb67d284817edd10986adaea48c8ddc913f972f5 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Wed, 12 Jul 2023 13:10:54 +0100 Subject: [PATCH] Copy to new args Addresses https://github.com/WordPress/gutenberg/pull/52120/files#r1260851646 --- packages/core-data/src/selectors.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/core-data/src/selectors.ts b/packages/core-data/src/selectors.ts index 4660b80699c90d..fabe12513c5b76 100644 --- a/packages/core-data/src/selectors.ts +++ b/packages/core-data/src/selectors.ts @@ -388,12 +388,13 @@ export const getEntityRecord = createSelector( getEntityRecord.__unstableNormalizeArgs = ( args: EntityRecordArgs ): EntityRecordArgs => { - const recordKey = args?.[ 2 ]; + const newArgs = [ ...args ] as EntityRecordArgs; + const recordKey = newArgs?.[ 2 ]; // If recordKey looks to be a numeric ID then coerce to number. - args[ 2 ] = isNumericID( recordKey ) ? Number( recordKey ) : recordKey; + newArgs[ 2 ] = isNumericID( recordKey ) ? Number( recordKey ) : recordKey; - return args; + return newArgs; }; /**