-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Refactor the inserter menu component and split into multiple smaller components #20880
Conversation
Size Change: -82 B (0%) Total Size: 857 kB
ℹ️ View Unchanged
|
Inserter seems to work well for me overall. One change, though, I see all categories expanded, except "Most Recent". Honestly I think the categories are a failed experiment, so that aspect does not bother me — though if this is an intentional change I'd also make the Most Recent be expanded by default. |
import { useInstanceId } from '@wordpress/compose'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
function InserterSearchForm( { onChange } ) { |
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.
Technically speaking, it's not a form :)
I'm wondering if it should be converted to form separately.
I restored the previous behavior. Let's consider changes here separately (we can maybe remove the collapsing at some point) |
Cool, fine with exploring that separately. That was the only behavior change I noted, so per your testing instructions I will defer to Gzregorz on the thumbs up! |
There are still some failing unit tests ( |
I've been battling with these tests for hours now :). I'm on the right track though :P |
yay tests fixed. |
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.
Quite an achievement to convert tests to work with React hooks 😃
We need better tools for unit tests and mocking data package in particular.
Code wise this refactoring looks good to go. I haven’t tested.
Co-Authored-By: Grzegorz (Greg) Ziółkowski <[email protected]>
8d3d2a1
to
c38ec3e
Compare
I believe this PR introduced a recent bug I filed. |
To prepare the addition of the block patterns into the Main Block Inserter, this PR refactors the code base of the InserterMenu component and split it into separate smaller components.
It rewrites some of it with React hooks at the same time.
Testing instructions