Skip to content

Commit

Permalink
Use generated Ids for id prop of faux suggestions rather than ever …
Browse files Browse the repository at this point in the history
…decrementing static negative numbers
  • Loading branch information
getdave committed Feb 10, 2020
1 parent 73eb46f commit 2295338
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/block-editor/src/components/link-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import classnames from 'classnames';
import { noop, startsWith } from 'lodash';
import { noop, startsWith, uniqueId } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -188,9 +188,9 @@ function LinkControl( {
type = 'internal';
}

return Promise.resolve( [
{
id: '-1',
return Promise.resolve(
[ {
id: uniqueId(),
title: val,
url: type === 'URL' ? prependHTTP( val ) : val,
type,
Expand Down Expand Up @@ -223,7 +223,7 @@ function LinkControl( {
// the a11y benefits afforded by `URLInput` to all suggestions (eg:
// keyboard handling, ARIA roles...etc).
return results.concat( {
id: '-2',
id: uniqueId(),
? results[ 0 ].concat( results[ 1 ] )
title: '',
url: '',
Expand Down

0 comments on commit 2295338

Please sign in to comment.