Skip to content

Commit

Permalink
Ensure edits are passed to save
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Jun 23, 2023
1 parent ed02496 commit fdd815c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function SidebarNavigationScreenNavigationMenu() {
useNavigationMenuHandlers();

const _handleDelete = () => handleDelete( navigationMenu );
const _handleSave = () => handleSave( navigationMenu );
const _handleSave = ( edits ) => handleSave( navigationMenu, edits );
const _handleDuplicate = () => handleDuplicate( navigationMenu );

if ( isLoading ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ function useSaveNavigationMenu() {
const { createSuccessNotice, createErrorNotice } =
useDispatch( noticesStore );

const handleSave = async ( navigationMenu, edits = {} ) => {
const handleSave = async ( navigationMenu, edits ) => {
if ( ! edits ) {
return;
}

const postId = navigationMenu?.id;
// Prepare for revert in case of error.
const originalRecord = getEditedEntityRecord(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ export default function SidebarNavigationScreenNavigationMenus() {
navigationMenu={ firstNavigationMenu }
handleDelete={ () => handleDelete( firstNavigationMenu ) }
handleDuplicate={ () => handleDuplicate( firstNavigationMenu ) }
handleSave={ () => handleSave( firstNavigationMenu ) }
handleSave={ ( edits ) =>
handleSave( firstNavigationMenu, edits )
}
/>
);
}
Expand Down

0 comments on commit fdd815c

Please sign in to comment.