Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Block API: Allow "array of attributes to be compared" for isActive property in block variations #30913
Block API: Allow "array of attributes to be compared" for isActive property in block variations #30913
Changes from 14 commits
e732e8a
a6ba309
456263c
2f84704
dc2fb96
0ed0178
9210ab4
c5fcb45
bad88e0
f82dc48
bcc9124
e836034
66af876
637b62b
66c4201
146d392
0e2c363
1ca52fc
21328a9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I'm not really sure where to put this. 😄 I'm also wondering why don't we
dispatch( blocksStore ).addBlockVariation( settings.variations )
instead of handling variations here:gutenberg/packages/blocks/src/store/reducer.js
Line 139 in 6ad2a43
For this reason we need to do the variations validation in two functions.
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.
Can we extract it to another PR? It isn't a blocker really and it requires some more thinking because you can register block variations also through the store directly. I don't remember exactly but most likely they are stored in two places in the store. It's similar to how block styles can be registered, so plugin authors could register styles or variations before the block gets registered so plugins wouldn't have to declare dependencies on each other.
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.
That makes sense. I didn't know it meant to be that way - registering variation even without an existing block type. This comes with its own challenges 😄
I revert the commit.
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.
I double-checked, it's stored in one reducer but you can add variations with
ADD_BLOCK_TYPES
orADD_BLOCK_VARIATIONS
😄