-
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
Navigation: Save theme location on button click #30340
Conversation
Size Change: +49 B (0%) Total Size: 1.42 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.
This is working well, thanks for addressing the issue so quickly.
I left a little bit of optional feedback.
editMenuName, | ||
editedMenu, | ||
menuEntityData, | ||
editMenuEntityRecord: editEntityRecord, |
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.
Maybe we can expose this as a function that takes a menu id and menu data as an alternative to returning menuEntityData
. The MENU_KIND
and MENU_POST_TYPE
aren't expected to change.
I also discovered recently that there's a useEntityProp
hook, that works similarly to useState
, so that wrapping that in some way might also be an option.
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 guess to elaborate more, I'd consider menuEntityData
as configuration that can be kept internal to useMenuEntity
.
Instead of returning it the hook could return a partially applied version of editEntityRecord
so that implementers don't have to worry about passing the MENU_KIND
and MENU_POST_TYPE
arguments.
Just to also mention that there are other ways of achieving this too.
-
We might consider moving some of this to the edit-navigation store—an action in the navigation store can dispatch actions on another store. Selectors can also select from other stores. We could expose an
editMenuName
action and agetEditedMenuName
selector for convenience. -
Or there's the
useEntityProp
hook that I mentioned (https://github.com/WordPress/gutenberg/blob/trunk/packages/core-data/src/entity-provider.js#L74-L117), that provides an easier way to edit individual properties. We could also consider partially applied versions (e.guseMenuEntityProp
, or maybe evenuseMenuEntityName
/useMenuEntityLocation
) of this hook for convenience.
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 have created a separate issue for this #30442
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 like the idea of useMenuEntityProp
. Happy to create PR and update existing code.
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.
Excellent @Mamaduka if you find the time to squeeze that it would be lovely 🙏
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.
Done #31132 ✅
Description
Closing #30139
Advances #30307
All menage location settings (in sidebar and modal window) are saved upon clicking the
save
button placed in the header.How has this been tested?
Navigation
save
buttonTypes of changes
Inconsistency fix
Checklist:
*.native.js
files for terms that need renaming or removal).