Skip to content
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

Error: The block "xxx" can have a maximum of 3 keywords. #11949

Closed
elliotcondon opened this issue Nov 15, 2018 · 17 comments · Fixed by #13848
Closed

Error: The block "xxx" can have a maximum of 3 keywords. #11949

elliotcondon opened this issue Nov 15, 2018 · 17 comments · Fixed by #13848
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Extensibility The ability to extend blocks or the editing experience Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Milestone

Comments

@elliotcondon
Copy link

Describe the bug
When registering a block type with more than 3 keywords, the following JS error is logged and the block type is not registered:

The block "xxx" can have a maximum of 3 keywords.

To Reproduce
Steps to reproduce the behavior:

  1. Create a basic block type with 4 keywords
  2. Check the console log

Expected behavior
The current behavior is too extreme.
The block type should be registered as normal, and WP should use the first 3 keywords ignoring any others if provided. There is also no need for a JS error, or even a warning.

@Soean Soean added [Feature] Block API API that allows to express the block paradigm. [Type] Enhancement A suggestion for improvement. labels Nov 15, 2018
@timelsass
Copy link
Contributor

A silent fail would be nice for prod build, and when using dev build to provide the console warn or error. Dev feedback should be more prominent

@elliotcondon
Copy link
Author

Hi @timelsass. Can you clarify on what you mean by "silent fail"?

  • Do you mean the block should fail to register? This seems overkill for such a minor setting.

@danielbachhuber
Copy link
Member

The block type should be registered as normal, and WP should use the first 3 keywords ignoring any others if provided.

I agree with this.

There is also no need for a JS error, or even a warning.

The warning could be helpful, but we could only show it in dev mode.

@danielbachhuber danielbachhuber added the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Nov 16, 2018
@danielbachhuber danielbachhuber added the [Feature] Extensibility The ability to extend blocks or the editing experience label Nov 16, 2018
jameelmoses added a commit to jameelmoses/gutenberg that referenced this issue Nov 16, 2018
@jameelmoses
Copy link

PR submitted 🤞

@timelsass
Copy link
Contributor

@elliotcondon my bad I meant suppressing the error instead in production build - as it would still be a useful warning for people who are developing and registering blocks.

@jameelmoses should this now become console.warn since input is being accepted a modified instead of console.error?

@jameelmoses
Copy link

@timelsass yeah probably. just wasn’t sure if i was allowed to change linting rules, but seems fine if console.error is being disabled

jameelmoses added a commit to jameelmoses/gutenberg that referenced this issue Nov 17, 2018
@jameelmoses
Copy link

changed to console.warn and added warn to allow array for linting

@swissspidy
Copy link
Member

Related discussion: #6633.

@aduth
Copy link
Member

aduth commented Feb 5, 2019

We should just abolish this 3-keyword limit. I haven't seen anyone provide any compelling reason for why it exist, and it's certainly caused more friction than value it's provided.

@aduth
Copy link
Member

aduth commented Feb 5, 2019

PR submitted 🤞

Afore-mentioned pull request: #11953

@jameelmoses
Copy link

@aduth is this something you want me to tackle? or you guys want to handle internally? im not sure if there's a series of changes that require more thought and strategy, or if it's just in this section of code.

@aduth
Copy link
Member

aduth commented Feb 5, 2019

@aduth is this something you want me to tackle? or you guys want to handle internally?

I'm not personally aware of any ongoing effort here, so feel free to take it on.

im not sure if there's a series of changes that require more thought and strategy, or if it's just in this section of code.

I think it's relatively well-contained here, but I'm happy to do some more digging if you ping me for a review on a related pull request.

jameelmoses added a commit to jameelmoses/gutenberg that referenced this issue Feb 5, 2019
@jameelmoses
Copy link

@aduth updated my PR to remove the restriction entirely

gziolo added a commit that referenced this issue Feb 13, 2019
* Fixes #11949: Error: The block "xxx" can have a maximum of 3 keywords.

* Fixes #11949: Error: The block "xxx" can have a maximum of 3 keywords.

* Fixes #11949: Error: The block xxx can have a maximum of 3 keywords.
@gziolo
Copy link
Member

gziolo commented Feb 13, 2019

Landed #13848 which removes this limit altogether.

@elliotcondon
Copy link
Author

Good work @gziolo

@jameelmoses
Copy link

What am I, chopped liver @elliotcondon? ¯_(ツ)_/¯

Jk ❤️

@elliotcondon
Copy link
Author

@jameelmoses Haha, sorry mate. Just looked closer at the PR.
"All work was done by @jameelmoses."

Thank you sir.

youknowriad pushed a commit that referenced this issue Mar 6, 2019
* Fixes #11949: Error: The block "xxx" can have a maximum of 3 keywords.

* Fixes #11949: Error: The block "xxx" can have a maximum of 3 keywords.

* Fixes #11949: Error: The block xxx can have a maximum of 3 keywords.
youknowriad pushed a commit that referenced this issue Mar 6, 2019
* Fixes #11949: Error: The block "xxx" can have a maximum of 3 keywords.

* Fixes #11949: Error: The block "xxx" can have a maximum of 3 keywords.

* Fixes #11949: Error: The block xxx can have a maximum of 3 keywords.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Extensibility The ability to extend blocks or the editing experience Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
10 participants