-
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
Ensure the overlay menu works when inserting navigation block patterns and that inner blocks are retained #37358
Conversation
Size Change: +136 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
31da4ee
to
ce0901c
Compare
expect( await getNavigationMenuRawContent() ).toMatchSnapshot(); | ||
} ); | ||
|
||
describe( 'Creating and restarting', () => { |
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.
This is the end-to-end test added in #36880. It was skipped, but I've fixed and re-enabled it here so that it asserts that the changes from that PR still work.
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.
Noted these don't provide full coverage for the issue uncovered in #37358 (review). Hopefully simple to add that coverage though?
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.
Thank you for working on these issues.
It fixes the Core issues you reference 🥳
However...unfortunately I found this PR regresses #36880.
- New Post
- Switch to code view and paste in:
<!-- wp:navigation {"overlayMenu":"none"} -->
<!-- wp:navigation-link {"label":"Hello world!","type":"post","id":1,"url":"http://localhost:8888/?p=1","kind":"post-type","isTopLevelLink":true} /-->
<!-- wp:navigation-link {"label":"Sample Page","type":"page","id":2,"url":"http://localhost:8888/?page_id=2","kind":"post-type","isTopLevelLink":true} /-->
<!-- /wp:navigation -->
- Update without switching out of code view.
- Switch to Visual Mode and select the Nav block - it will be converted to controlled blocks.
- Click
Select Menu -> Create New
- Observe the broken UI state with an infinite spinner.
- Check
wp.data.select('core/block-editor').getBlocks()
and look for the Nav block. See that it still has inner blocks.
I have tried to push a fix which manually updates the innerblocks in the block editor store.
I'd prefer this fix was separated out from the overlay menu so it's easier to revert as required, but at this stage it's not a blocker.
Added an e2e test for the fix, thanks for pushing a fix. As you say in the comment, blocks shouldn't be concerned about this, but I think this is the first use case of a core block that has both uncontrolled and controlled blocks. |
885f9a0
to
afa6931
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.
Tested yesterday and only thing that changed since is addition of an e2e test.
Thanks again for fixing this bug.
Tested it on Wednesday and both issue cases seems to work now. Big Thank you. 🙂 |
…s and that inner blocks are retained (#37358) * Show overlay menu for unsaved inner blocks too * Fix uncontrolled inner blocks being deleted * Add e2e test for converting markup inner blocks to a navigation post * Change useNavigationMenu back to trunk * Re-enable single entity test * Attempt to sync block editor store with controlled state Addresses https://github.com/WordPress/gutenberg/pull/37358\#discussion_r769699131 * Add e2e test for lingering uncontrolled blocks issue Co-authored-by: Dave Smith <[email protected]>
Description
Fixes #36670
Fixes #37354
This fixes the two issues mentioned above. When testing the first one, I noticed the second one was no longer working.
The first issue is that the
UnsavedInnerBlocks
component that's shown when the block has standard uncontrolled inner blocks (this is hard to describe without using technical terms) didn't use theResponsiveWrapper
component that's used for showing the overlay menu. That was a pretty simple fix.The second issue was introduced when another fix went in recently (#36880). It's understandable as the
UnsavedInnerBlocks
behavior there isn't all that easy to follow, it exists to support an edge case, and also there are no end to end tests.How has this been tested?
Also test that the fix in #36880 continues to work.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.js
files for terms that need renaming or removal).