-
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
Scope Nav Menu sidebar to Plugin only #40083
Scope Nav Menu sidebar to Plugin only #40083
Conversation
Size Change: +23 B (0%) Total Size: 1.22 MB
ℹ️ View Unchanged
|
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 and works as described. The code is the minimal intervention required.
Adding here for good measure @talldan 's mention that we should also check "if the original PR introduced any new selectors, actions or other public APIs and conditionally excluding those from core". |
@getdave this change triggers the following warning in Site Editor - WP 6.0 betas. |
I'll fix that |
What?
This PR scopes the new Nav Menu sidebar to be a Plugin only feature in order to ensure it does not get included in WordPress 6.0.
Why?
Please see reasons in #40080.
How?
I'm using
process.env.IS_GUTENBERG_PLUGIN
to scope the Nav Sidebar code itself and the toggle button in the Nav block toolbar.I have tried to optimise for dead code elimination by rendering either the component itself or a
React.Fragment
. By using the true component only by way of a conditional Webpack will eliminate the dead code within theif()
when we're not building for the Gutenberg Plugin.There may be a better way to achieve this - cc'ing @talldan who I believe created the
IS_GUTENBERG_PLUGIN
functionality.Testing Instructions
package.json
file and update the following line to befalse
gutenberg/package.json
Line 22 in 21421dc
npm run dev
.package.json
back totrue
again after you test this PR 😄Screenshots or screencast
The following screenshots show the elements that should be excluded by this PR: