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
Add: Frontend section presets output #42124
Add: Frontend section presets output #42124
Changes from 1 commit
97499c4
5b2f8a4
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.
🤔 We don't have a
version
for thesettings
stored in the block, as we do in thetheme.json
. This is problematic because we assume that thesettings
stored in the block use the latest format, se we can run into this issue:settings
in the block don't have a version it'll assume it's the latest (version 3), and we don't know what happens (depends on the changes)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 thinking that we may need to store the version in the block settings as well, unless we make the migration code to infer the version from the data. Thoughts?
If we add this field, how should we name it? Using
themeJsonVersion
sounds a bit weird, although I don't have anything against.settingsVersion
could work but if we add laterstyles
is a bit limiting. All things considered,themeJsonVersion
could work.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 guess we can add a settings version attribute. What would be your preferred name: settingsVersion, themeJsonVersion (implying it could also end up used in styles), version inside settings field (it would make setting object in blocks diverge from settings in theme.json), or another name? Just "version" as top-level attribute does not look good as it seems to apply to everything, not just theme.json-related stuff.
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.
This is an issue that precedes this PR. We can address it in a follow-up. We need to make sure there's always a version in the block attributes and both client & server discard the settings if there's not.
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.
Nice one ❤️ Wasn't super comfortable hard-coding the 0 index.
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.
This gist of code is not used at the moment, correct? My understanding is that it is just a way to make the
scope
androot_selector
options work with this part of the code as well. I wasn't sure how to test this.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.
Yes, it is not used at the moment, but it is to make sure the function also works with base-layout-styles origin. I don't think it will be needed but I preferred to make the function consistent.
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.
Shouldn't this be?
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.
Is it removing this and add a comment with what changed? I understand the change is making sure no empty scope ends up being used, but not sure why we didn't that before.
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 don't think the changes we are making to the function are worth a comment. We are just fixing some cases with empty selectors.
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.
This is purely a style choice, it's totally up to you. Personally, I find this more readable: