Skip to content

Commit

Permalink
fix: only add tag to selection if it hasn't been selected yet
Browse files Browse the repository at this point in the history
  • Loading branch information
thomcsmits committed May 2, 2024
1 parent e444bfb commit 9164960
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sites/docs/src/pages/_DemoList.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ function DemoList(props) {


/**
* Add attr from click event to attrsSelected.
* Add attr from click event to attrsSelected, if it isn't yet in there.
*/
function selectAttr(event) {
const newAttrs = Array.from(attrsSelected);
newAttrs.push(event.target.innerText);
setAttrsSelected(newAttrs);
if (!newAttrs.includes(event.target.innerText)) {
newAttrs.push(event.target.innerText);
setAttrsSelected(newAttrs);
}
}

/**
Expand Down

0 comments on commit 9164960

Please sign in to comment.