-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Parser: Update validateBlock to use fixedBlock #62178
Conversation
Size Change: +118 B (+0.01%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Adding labels to mark as potential candidate for WP 6.6. |
4af4d61
to
2fa8116
Compare
It would have been helpful to have testing instructions or testing coverage for this path, but based on the original code, the fix looks correct. |
If that was an issue with refactoring then we definitely should add a test that will prevent future regressions. |
Thank you, @tjcafferkey! The quick test shows that the new unit test also passes on |
}, | ||
save: ( { attributes } ) => ( | ||
// eslint-disable-next-line react/no-unknown-property | ||
<div class={ attributes.className }> |
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.
If I'm not wrong there's no need to use attributes.className here as it should be done automatically no?
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 thought so too, but apparently not.
This change is logical indeed. Makes me wonder how useful the built-in fixes are (This bug is around for some time now) |
Huh, @Mamaduka it looks like it's passing on The test would fail on |
@tjcafferkey I guess that means that this PR actually doesn't do anything but clarify things. It's good anyway but at least we know that the fixes are useful and used :P |
@youknowriad ha yes. do you think I should update |
@tjcafferkey I think so, assuming there's no perf impact or anything, it's better to avoid mutating function arguments like that. |
Flaky tests detected in 246eb14. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9369233307
|
* Run validateBlock against fixedBlock * Unit test for block validation applying customClassNames * Add another custom class to the unit test * Avoid mutating blockAttributes
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.
A bit late, but this looks good. Thanks @tjcafferkey
Fixes #62176
What?
Updated the second
validateBlock
execution to run againstfixedBlock
after we have attempted to apply fixes if it fails validation for the first time.Why?
It appears as though we are revalidating the original
unvalidatedBlock
instead offixedBlock
during the second execution ofvalidateBlock()
.How?
Updated the variable being passed to
validateBlock
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast