-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Polish editor PostFormat and PostFormatPanel components. #24079
Conversation
Size Change: -18 B (0%) Total Size: 1.05 MB
ℹ️ View Unchanged
|
651a9ae
to
fbc62c7
Compare
a536b68
to
63a2c07
Compare
831ddf7
to
43fb27f
Compare
43fb27f
to
02a24e9
Compare
02a24e9
to
7ca79f1
Compare
33ef6a1
to
0845115
Compare
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've reviewed half of this, but as a reviewer I've found this refactor has too many logic changes and parts that won't work the same as before.
A good rule of thumb for a refactor is that it should unit test the same as it did previously (if it had tests).
How about an intermediate PR where we refactor the existing component to hooks without changing logic?
Thanks for doing that. Merged that one just now. What's the next step? |
ab71abb
to
0ce47ba
Compare
021ea6c
to
2f4de98
Compare
2f4de98
to
589ff78
Compare
589ff78
to
7128baa
Compare
7128baa
to
cb172ac
Compare
cb172ac
to
1024849
Compare
1024849
to
8aa02d3
Compare
Ultimately, this PR is basically just nitpicking, and most of the more useful changes have made it into |
Description
This PR refactors two components in the
editor
package:PostFormat
andPostFormatPanel
. The changes made are designed to simplify the code and make it easier to implement changes I want to make in #24024.List of changes
undefined
/null
handling using nullish coalescing and native JS array methods.PostFormatPanel
'suseSelect
callback to return only a single value.PostFormatPanel
'sPostFormatSuggestion
to take a single argument for the callback, rather than one for a callback and one for a value to pass to that callback.PostFormatPanel
's containedPanelBody
to use aFragment
for its title element, rather than an array of elements withkey
props.PostFormat
andPostFormatPanel
to move a lot of the logic into theuseSelect
callbacks, to avoid unnecessarily running the same checks on every render.Checklist: