Skip to content

Commit

Permalink
navigation-link: calling setter once
Browse files Browse the repository at this point in the history
  • Loading branch information
retrofox committed Dec 12, 2019
1 parent 6c66fa0 commit a8b7c81
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/block-library/src/navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,18 @@ const updateLinkSetting = ( setter ) => ( setting, value ) => {
* @param {string} label Link label.
*/
const updateLink = ( setter, label ) => ( { title: newTitle = '', url: newURL = '', id = -1 } = {} ) => {
setter( {
const linkSetting = {
title: escape( newTitle ),
url: newURL,
id,
} );
};

// Set the item label as well if it isn't already defined.
if ( ! label ) {
setter( { label: escape( newTitle ) } );
linkSetting.label = linkSetting.title;
}

setter( linkSetting );
};

function NavigationLinkEdit( {
Expand Down

0 comments on commit a8b7c81

Please sign in to comment.