Refactor the inserter menu component and split into multiple smaller components#20880
Refactor the inserter menu component and split into multiple smaller components#20880youknowriad merged 4 commits intomasterfrom
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.
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. |
gziolo
left a comment
There was a problem hiding this comment.
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.
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