Skip to content

Commit

Permalink
only modify attributes when new values are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
gwwar committed May 4, 2021
1 parent 45c5ccb commit 407b236
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/block-library/src/navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ export const updateNavigationLinkBlockAttributes = (
const kind = isCustomLink ? 'custom' : newKind;

setAttributes( {
url: encodeURI( url ),
label,
opensInNewTab,
...( Number.isInteger( id ) && { id } ),
...( url && { url: encodeURI( url ) } ),
...( label && { label } ),
...( undefined !== opensInNewTab && { opensInNewTab } ),
...( id && Number.isInteger( id ) && { id } ),
...( kind && { kind } ),
...( type && ! isCustomLink && { type } ),
} );
Expand Down

0 comments on commit 407b236

Please sign in to comment.