From 4867dfc6bb9286865ae19e332b06a29b35ce7ab1 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Mon, 9 Dec 2024 21:18:27 -0800 Subject: [PATCH] Fix re-renders caused by `getEntityRecordsPermissions` after #67667 (#67770) * Update getEntityRecordsPermissions signature to allow string ids * Fix regression caused in #67667 Co-authored-by: manzoorwanijk Co-authored-by: Mamaduka --- packages/core-data/src/private-selectors.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/core-data/src/private-selectors.ts b/packages/core-data/src/private-selectors.ts index abdf2c837e8ed6..0d4a28ad174a19 100644 --- a/packages/core-data/src/private-selectors.ts +++ b/packages/core-data/src/private-selectors.ts @@ -57,7 +57,12 @@ export const getBlockPatternsForPostType = createRegistrySelector( */ export const getEntityRecordsPermissions = createRegistrySelector( ( select ) => createSelector( - ( state: State, kind: string, name: string, ids: string[] ) => { + ( + state: State, + kind: string, + name: string, + ids: string | string[] + ) => { const normalizedIds = Array.isArray( ids ) ? ids : [ ids ]; return normalizedIds.map( ( id ) => ( { delete: select( STORE_NAME ).canUser( 'delete', { @@ -92,7 +97,7 @@ export function getEntityRecordPermissions( name: string, id: string ) { - return getEntityRecordsPermissions( state, kind, name, [ id ] )[ 0 ]; + return getEntityRecordsPermissions( state, kind, name, id )[ 0 ]; } /**