-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Template activation: adjust saveEntityRecord compat #72170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
packages/core-data/src/actions.js
Outdated
| for ( const [ key, value ] of Object.entries( record ) ) { | ||
| if ( typeof value === 'function' ) { | ||
| const evaluatedValue = value( | ||
| select.getEditedEntityRecord( kind, name, recordId ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly not sure why this works because this is basically:
wp.data.select('core').getEditedEntityRecord('postType','wp_template','twentytwentyfour//home');
And there should be no edited entities with those IDs 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't checked, but it might be resolver forwarding. It looks like getEntityRecord is backward compatible.
gutenberg/packages/core-data/src/resolvers.js
Lines 230 to 233 in 7fdd9d2
| /** | |
| * Requests an entity's record from the REST API. | |
| */ | |
| export const getEditedEntityRecord = forwardResolver( 'getEntityRecord' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Omg, you're right!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discovered a related (forwarded resolver) but different issue with this action recently as well 😅
|
Size Change: +1 B (0%) Total Size: 1.96 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 676b389. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18348284693
|
|
No longer needed after #72223. |
What?
Closes
saveEntityRecord might be called with content properties that have a function. In that case, we need to fetch the current edited entity and call the function with the edited entity as an argument.
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast