Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions packages/core-data/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,18 +368,11 @@ export const getEntityRecords =
meta
);

// When requesting all fields, the list of results can be used to resolve
// the `getEntityRecord` and `canUser` selectors in addition to `getEntityRecords`.
// See https://github.com/WordPress/gutenberg/pull/26575
// See https://github.com/WordPress/gutenberg/pull/64504
// See https://github.com/WordPress/gutenberg/pull/70738
if ( ! query.context ) {
const targetHints = records
.filter(
( record ) =>
!! record?.[ key ] &&
!! record?._links?.self?.[ 0 ]?.targetHints
?.allow
!! record?._links?.self?.[ 0 ]?.targetHints?.allow
)
.map( ( record ) => ( {
id: record[ key ],
Expand Down Expand Up @@ -417,13 +410,16 @@ export const getEntityRecords =
);
}

if ( ! query?._fields ) {
// When requesting all fields, the list of results can be used to resolve
// the `getEntityRecord` selector in addition to `getEntityRecords`.
// See https://github.com/WordPress/gutenberg/pull/26575
// Todo https://github.com/WordPress/gutenberg/issues/26629
if ( ! query?._fields && ! query.context ) {
Comment on lines +413 to +417
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm working on #26629 and hope to remove these conditions entirely.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh nice, that's very related to #70789

Copy link
Member Author

Choose a reason for hiding this comment

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

Here's the first part, which should solve the additional requests problem - #71541.

Copy link
Member Author

@Mamaduka Mamaduka Sep 10, 2025

Choose a reason for hiding this comment

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

Here's the follow-up for this particular case - #71575.

dispatch.finishResolutions(
'getEntityRecord',
getResolutionsArgs( records )
);
}
}

dispatch.__unstableReleaseStoreLock( lock );
} );
Expand Down
Loading