javascript icon indicating copy to clipboard operation
javascript copied to clipboard

Do not use lodash's uniqueId for component ids

Open igorschoester opened this issue 6 years ago • 0 comments

Explanation

In hindsight, lodash's uniqueId is not handy to use in component Ids because snapshots and other tests need to get updated if the amount of times it is called changes.

It is being used as ID property in the following places:

  • SnippetEditorFields uses it for the slug and label.
  • HelpTextWrapper uses it for the panel id.
  • ReplacementVariableEditor uses it for the editor and label.
  • The content analysis app's SelectTestPaper uses it for the select id.

Technical decisions

For inspiration / context see the PR where this was changed for the KeywordInput and SynonymsInput components: https://github.com/Yoast/javascript/pull/263

Maybe the SelectTestPaper one is not that interesting since it is a test app.

Feedback?

igorschoester avatar May 08 '19 13:05 igorschoester