-
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
Remove custom button and (conditionally) show single menu on Navigation route in Browse Mode #51565
Remove custom button and (conditionally) show single menu on Navigation route in Browse Mode #51565
Conversation
Size Change: -531 B (0%) Total Size: 1.4 MB
ℹ️ View Unchanged
|
Flaky tests detected in edb424f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5309640103
|
This comment was marked as resolved.
This comment was marked as resolved.
a176086
to
3dee12c
Compare
This PR does expose some of the loading inadequacies. Let's tidy those in a follow up. |
packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
); | ||
} | ||
}; | ||
const _handleDelete = () => handleDelete( navigationMenu ); |
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.
Is this a pattern we use elsewhere? Another option could be to call it handleDeleteBound
...
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.
Yeh I mean...it isn't exactly elegant 🤷
I'm not 100% about the API on this hook yet. Let's allow new requirements to drive any further refactoring however.
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.
LGTM
…on route in Browse Mode (WordPress#51565) * Remove custom button and show single menu on Navigation route * Extract hooks * Pass menu to all hooks * Use SingleMenu component and hooks on Navigation listing route * Move hooks to file file * Consolidate to a single hook * Improve hooks by passing arg at call time * Rename hooks
What?
Renders a single Navigation directly on the
/navigation
route of the Site Editor if there is only a single menu. If there are multiple menus then we render a list as pertrunk
.Closes #51561
Why?
Reasoning was outlined by Riad in #51561.
This change avoids requiring consumers of the Site Editor routes from having to programmatically determine which route to send someone to if they have a single menu vs multiple menus.
We encapsulate the behaviour and logic inside the route components and thus a consumer can simply go to
/navigation
and know they will see the "right" thing.How?
Extracts the code for displaying a single menu into reusable component and hooks. Then shares this between the routes for both
/navigation
routeTesting Instructions
Navigation
in Browse Mode.Navigation
.Testing Instructions for Keyboard
Screenshots or screencast
Screen.Capture.on.2023-06-16.at.15-47-10.mp4