-
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
Fix: refactor pre publish panel to use function component instead of class #58441
Fix: refactor pre publish panel to use function component instead of class #58441
Conversation
Size Change: -139 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
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.
It would be nice to replace HoC usage with hooks while we're refactoring the component.
Flaky tests detected in 16b7fbf. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7727325230
|
@fabiankaegy, we can drop P.S. We should also avoid using the global |
@fabiankaegy, do you mind if I push small changes on this branch? Mostly some personal nits :) |
@Mamaduka not at all :) you are always welcome to take over any branch I'm working on 👍 |
hasTags: !! tags?.length, | ||
isPostTypeSupported: areTagsFetched && _isPostTypeSupported, |
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.
- it is preferable to derive values like
hasTags
insidemapSelec
. It will prevent re-rendering components when a new tag is assigned to a post. - I have combined post-type support check since if tags taxonomy has not been fetched yet, the
_isPostTypeSupported
value will always befalse
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.
The panel works as before after the refactoring.
What?
Refactor pre publish panel to use function component instead of class
Why?
For easier maintainance going forward
How?
Replace component constructor with hook based state
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast