Skip to content

Plugins API: Fix the plugin 'render' property validation#79315

Merged
Mamaduka merged 4 commits into
WordPress:trunkfrom
sdnunca:fix/plugins-api-render-component-check
Jun 18, 2026
Merged

Plugins API: Fix the plugin 'render' property validation#79315
Mamaduka merged 4 commits into
WordPress:trunkfrom
sdnunca:fix/plugins-api-render-component-check

Conversation

@sdnunca

@sdnunca sdnunca commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

What?

PR fixes the plugin's render property validation which is failing for memoized components.

Why?

#78674 updated withSelect to return a memoized component. Plugins using withSelect in the render property now fail the typeof === '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

  1. Add memo (or use withSelect) to a plugin's render property.
  2. Open the post editor.
  3. Confirm you see the 'The "render" property must be specified and must be a valid function.' on trunk.
  4. Confirm there's no error on this branch.

Testing Instructions for Keyboard

Screenshots or screencast

Before After

Use of AI Tools

@sdnunca sdnunca requested a review from adamsilverstein as a code owner June 18, 2026 11:51
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sdnunca <[email protected]>
Co-authored-by: Mamaduka <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions Bot added [Package] Plugins /packages/plugins First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository labels Jun 18, 2026
@github-actions

Copy link
Copy Markdown

👋 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.

@Mamaduka Mamaduka added the [Type] Enhancement A suggestion for improvement. label Jun 18, 2026
@Mamaduka

Copy link
Copy Markdown
Member

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.

Comment thread packages/plugins/src/api/index.ts
@sdnunca

sdnunca commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

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.

Thank you for the feedback @Mamaduka.
I've added a separate test so we cover both the Component and memo cases.

@Mamaduka Mamaduka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, @sdnunca!

The fix works as expected ✅

@Mamaduka Mamaduka merged commit 4429bf0 into WordPress:trunk Jun 18, 2026
55 of 58 checks passed
@github-actions github-actions Bot added this to the Gutenberg 23.5 milestone Jun 18, 2026
@bgrgicak bgrgicak added [Type] Bug An existing feature does not function as intended and removed [Type] Enhancement A suggestion for improvement. labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Plugins /packages/plugins [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants