Skip to content

Update README.md#60346

Open
tomepajk wants to merge 1 commit intoWordPress:trunkfrom
tomepajk:patch-2
Open

Update README.md#60346
tomepajk wants to merge 1 commit intoWordPress:trunkfrom
tomepajk:patch-2

Conversation

@tomepajk
Copy link
Copy Markdown
Contributor

@tomepajk tomepajk commented Apr 1, 2024

What?

I tried using the example above, useCommandLoader, which cannot be run in a plugin.

The attached example is functional out of the box ( can be just copy pasted as a starting point ).

Why?

The useCommandLoader has synthax errors and incomplete imports, increasing the barrier of acceptance.

How?

  • Fixed a synthax error at line 31.
  • replaced postType with record.type on line 46 and 49.
  • Changed the registering of the command on line 67.
  • Added every import, so the snippet works out of the box

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2024

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: tomepajk <tomepajk@git.wordpress.org>

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

@tomepajk
Copy link
Copy Markdown
Contributor Author

tomepajk commented Apr 1, 2024

Maybe the right approach is patching the UseCommandLoader code block, but I am not sure if that is the case, as they are two different methods. I would appreciate some guidance.

Another option is to replace https://developer.wordpress.org/block-editor/reference-guides/packages/packages-commands/#usecommandloader With #registerCommandLoader with the example

@Mamaduka Mamaduka added [Type] Developer Documentation Documentation for developers [Package] Commands /packages/commands labels Apr 1, 2024
@t-hamano
Copy link
Copy Markdown
Contributor

t-hamano commented Sep 5, 2025

Hi @tomepajk, sorry for the late reply.

The useCommandLoader has synthax errors and incomplete imports, increasing the barrier of acceptance.

Could you explain this point a bit more? If the useCommandLoader example has some errors, we need to fix them instead of adding a new example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Commands /packages/commands [Type] Developer Documentation Documentation for developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants