-
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
Navigation: Fix ListView deprecation notice #51094
Conversation
@@ -32,6 +32,7 @@ const BLOCKS_WITH_LINK_UI_SUPPORT = [ | |||
'core/navigation-link', | |||
'core/navigation-submenu', | |||
]; | |||
const { PrivateListView } = unlock( blockEditorPrivateApis ); |
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.
A minor code quality change.
( select ) => { | ||
const { __unstableGetClientIdsTree } = select( blockEditorStore ); | ||
return __unstableGetClientIdsTree( clientId ); | ||
return !! select( blockEditorStore ).getBlockCount( clientId ); |
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 component doesn't need a whole tree for the hasChildren
check.
Size Change: -13 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
Flaky tests detected in 10655de. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5121817369
|
10655de
to
25453c9
Compare
Rebase and ready for review 🙇 |
Thanks for opening this one @Mamaduka! Code-wise this looks good to me, but it might be worth getting some feedback from @scruffian or @getdave — I remember there were some previous discussions about the trade-offs between passing down |
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.
but it might be worth getting some feedback...
On closer inspection, I think this one's safe to land — I was thinking of the navigation editor within the site editor's browse mode, which also throws the deprecation warning.
For this PR, I see that within the ListView
's useListViewClientIds
, it'll wind up calling __unstableGetClientIdsTree
to get blocks
as this component used to (here), so functionally there'll be no difference with this one 👍
✅ Tested that Navigation blocks still display their block tree correctly in the sidebar editor, and when switching between blocks
✅ Checked that the empty state works as on trunk
✅ Deprecation warning isn't appearing anymore while editing a Navigation block
LGTM! ✨
Sorry I didn't get to this one in time. I think we decided it was ok to remove the property so we're all good. Thanks for thorough testing 🙇 |
* Navigation: Fix ListView deprecation notice * Unlock component at the file level
What?
This is a follow-up to #49417.
PR fixes the deprecation notice for the Navigation block settings list view.
How?
Only pass
rootClientId
as the deprecation message suggest.Testing Instructions
Screenshots or screencast