-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add @wordpress/navigation package #52134
Conversation
Co-authored-by: Maggie <[email protected]>
8a940e8
to
84d1c05
Compare
I think the CHANGELOG.md file didn't get commited |
Size Change: -22.9 kB (-2%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
I didn't make one yet! |
In many ways I like this idea of DRYing up the Navigation code. This becomes more pressing as we now have My concern is that whatever we export here becomes a public API whereas as things stand a lot of this is kept private within packages. This makes things a lot less flexible so I would be hesitant given that
@youknowriad and I discussed this a while back when I first proposed a similar package a couple of years ago. However I appreciate the landscape has changed and we now have the private API tooling to lean on. |
I think we can avoid this by using the private API tools |
Flaky tests detected in 1141e93. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5422352979
|
Thanks for opening the PR. I think creating packages to share internal utilities is not necessary a good thing, so my question would be, what is the actual purpose of this package? if I'm a third-party developer, what can I use this package for? Also what are the dependencies of this package? Is this a generic package any npm consumer can use? Is it a WP specific package? If it's a WP specific or internal package to reuse code, is there another place where we can put this code without creating a package. |
The purpose of the package is code reuse. We need the same code in both the edit-site and block-library packages. Are there other places we could put the code to share it between those packages? |
I will also refer folks to this previous PR where I suggested doing pretty much the same thing to share logic between the @youknowriad It might be useful to have some mechanism by which we can share code without it becoming a public package. Like "internal packages"? I'd be the first one to say "let's avoid hasty abstractions" which is why I'm nervous about creating a public package full of abstractions that are useful now but may become superfluous in the future. The counter argument is that Navigation has now become a defacto part of the Editor UI by way of it existing
...therefore a package dedicated to this concept seems logical. This is similar to the way we have packages for Media, for example. Some ideas of things that we might want to expose might be:
Update: it's useful to note the APIs that have stayed consistent since I proposed @wordpress/menus and consider making them the first public APIs in this newly proposed package. |
Could we do what we are doing with the icons and interface packages here, @youknowriad ? |
Another idea: Can we start with a private API in block-library to be consumed by site editor? (It's also not ideal because block-library is supposed to almost be autonomous, just registers blocks, but it's still a private API, so maybe fine to start like that |
What?
This adds a new navigation package, so that we can share code between the block library and the site editor.
Why?
To be able to achieve things like #51805, without duplicating loads of code.
How?
For now this just moves a few useful things to the package, but going forward we should migrate more things there as they become shared.
Testing Instructions