Skip to content

Commit

Permalink
Fix re-renders caused by getEntityRecordsPermissions after #67667 (#…
Browse files Browse the repository at this point in the history
…67770)

* Update getEntityRecordsPermissions signature to allow string ids
* Fix regression caused in #67667

Co-authored-by: manzoorwanijk <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
3 people authored Dec 10, 2024
1 parent 7159a78 commit 4867dfc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/core-data/src/private-selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down Expand Up @@ -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 ];
}

/**
Expand Down

1 comment on commit 4867dfc

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 4867dfc.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12249908025
📝 Reported issues:

Please sign in to comment.