From 5d2c7b3ae01b0ae41c3f64a75a1f9154341260a7 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 e260d1d512c736..b6b36fad2ee934 100644 --- a/packages/core-data/src/selectors.ts +++ b/packages/core-data/src/selectors.ts @@ -383,12 +383,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; }; /**