-
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: Show the loading indictor when users add a new navigation menu #46855
Conversation
@@ -49,6 +51,24 @@ const MenuInspectorControls = ( { | |||
[ clientId ] | |||
); | |||
|
|||
const experimentMainContent = () => { |
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.
I extracted this as otherwise the different ternarys become hard to grok.
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.
Defining components within components should be avoided. Rather let's extract two components in the same file but outside the definition of the ` components:
<ExperimentControls />
<DefaultControls />
This will fix the ternary problem that motivated the change whilst also making the code easier to read and better follow SRP.
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.
Thanks for the review. I added a commit for this.
Size Change: +55 B (0%) Total Size: 1.32 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.
I tested this and the loading state is now perfectly in sync which greatly improves the experience.
I think we should rework the code as noted in my comment below...
@@ -49,6 +51,24 @@ const MenuInspectorControls = ( { | |||
[ clientId ] | |||
); | |||
|
|||
const experimentMainContent = () => { |
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.
Defining components within components should be avoided. Rather let's extract two components in the same file but outside the definition of the ` components:
<ExperimentControls />
<DefaultControls />
This will fix the ternary problem that motivated the change whilst also making the code easier to read and better follow SRP.
9a25cf0
to
ad2a07c
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.
This is working well for me, and the code is much cleaner 👍
What?
As raised in #46140, we need to remove the off canvas editor when users are creating new menus, so that the UI reflects what is happening.
Why?
This makes it clear that something is happening when a new menu is being created.
How?
We pass the "isLoading" const down as a prop to MenuInspectorControls and use it to control the visibility of the OffCanvasEditor.
Testing Instructions
Testing Instructions for Keyboard
As above
Screenshots or screencast
Screen.Recording.2023-01-03.at.16.40.17.mov