Plugins API: Fix the plugin 'render' property validation#79315
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @sdnunca! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
|
Thank you, @sdnunca! Do you mind adding a test case that would fail without this fix? I think checking that the memoize function component can pass the check is what we want to test. |
What?
PR fixes the plugin's render property validation which is failing for memoized components.
Why?
#78674 updated
withSelectto return a memoized component. Plugins usingwithSelectin the render property now fail thetypeof === 'function'validation.We've previously made similar changes for the blocks API.
How?
Use the isValidElementType from the official react-is library to check the edit property's validity correctly.
Testing Instructions
withSelect) to a plugin's render property.'The "render" property must be specified and must be a valid function.'on trunk.Testing Instructions for Keyboard
Screenshots or screencast
Use of AI Tools