-
Notifications
You must be signed in to change notification settings - Fork 4.6k
List View: Restructure the BlockNavigation component #31892
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
Conversation
|
Size Change: +241 B (0%) Total Size: 1.06 MB
ℹ️ View Unchanged
|
david-szabo97
left a comment
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.
Changes make sense to me. Works as expected! ✅
Addison-Stavlo
left a comment
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 also tests well, and the restructure looks great to me!
f1efb98 to
757f20b
Compare
|
Just a note that I'll rebase this and sort the conflicts out once #31290 goes in. |
| export { default as BlockEdit, useBlockEditContext } from './block-edit'; | ||
| export { default as BlockIcon } from './block-icon'; | ||
| export { default as BlockNavigationDropdown } from './block-navigation/dropdown'; | ||
| export { default as __experimentalBlockNavigation } from './block-navigation'; |
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'd be great to call this ListView or similar. Maybe it could all be moved to a list-view folder leaving only the dropdown in the block navigation folder (which might also be a candidate for deprecation).
That is quite a big change, so definitely optional!
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 actually a great idea. 🤔
I'll try pushing a commit and see if git manages to keep the diff readable, otherwise I'll move to a follow up.
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.
Ooof, it went from +10-10 to +400-400 🤣
67ecaca to
2784f50
Compare
|
As suggested by @talldan I've taken the chance here of renaming the whole I've left Let me know what you think. |
talldan
left a comment
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.
Awesome to see that name change finally happen.
I think it needs a rebase and to solve conflicts with #32063, which was recently merged, but other than that this is working really well, great job 👏 .
| const getSlotName = ( clientId ) => `ListViewBlock-${ clientId }`; | ||
|
|
||
| function BlockNavigationBlockSlot( props, ref ) { | ||
| function ListViewBlockSlot( props, ref ) { |
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 Slot/Fill could be a candidate for deletion in the future. It was an experiment that didn't really go anywhere, but it's removal would help simplify the code quite a bit.
Replace the deprecated BlockNavigationTree with BlockNavigation Remove the deprecated BlockNavigationTree component Try renaming into ListView More renaming!
13528cd to
29c63c2
Compare
|
Hope it's not too presumptuous, but I wanted to get this one merged, so I've rebased, fixed conflicts and will merge it when tests pass. |
|
Thank you so much @talldan! |
* Use BlockNavigationTree as main component Replace the deprecated BlockNavigationTree with BlockNavigation Remove the deprecated BlockNavigationTree component Try renaming into ListView More renaming! * Update README title Co-authored-by: Daniel Richards <[email protected]>
Description
Follow up to #31290.
While working on the list view it became clear that the
BlockNavigationcomponent is improperly structured for its current use cases.The main component is not exported in the package, but only used internally by
BlockNavigationDropdown, which is exported as a stable component.At the same time,
BlockNavigationTreeis exported (experimentally), used in multiple different packages, and even internally byBlockNavigationitself.As far as I can see, there is no reason to keep
BlockNavigation, and instead there are many reasons to turnBlockNavigationTreeas the main component.Proposed changes:
BlockNavigationcomponent, and "merge" it intoBlockNavigationDropdown.BlockNavigationTreeintoBlockNavigation.BlockNavigationTree: it can still be used with the old name and from the old path, but it throws a deprecation warning in the console.BlockNavigationTreeintoBlockNavigation.Notes
There was no need of updating the component's readme, as it works well enough for the new usage.
Although, the screenshots should be updated, as they refer to the dropdown version, which is now not the primary way of using this component.
The screenshots are uploaded to make.wordpress.org, but I don't know the actual procedure.
How has this been tested?
Smoke test the List View in: Post Editor, Site Editor, Navigation block.
Types of changes
Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist:
*.native.jsfiles for terms that need renaming or removal).