Skip to content

Commit

Permalink
[PLAY-91] Add unique key prop to text input (#1741)
Browse files Browse the repository at this point in the history
* Trying to create a unique key

* Starting over

* Added key prop to text input

* Refactored unique key prop to be more reliable
  • Loading branch information
kyleschechter authored Feb 15, 2022
1 parent e202f8a commit c116cab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions playbook/app/pb_kits/playbook/pb_text_input/_text_input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ const TextInput = (props: TextInputProps, ref: React.ElementRef<"input">) => {
globalProps(props),
className,
])
const uniqueTextInputKey = `${id ? id : ''}${Math.ceil(Math.random() * 100000)}`

const addOnIcon = (
<Icon
className="add-on-icon"
Expand All @@ -89,6 +91,7 @@ const TextInput = (props: TextInputProps, ref: React.ElementRef<"input">) => {
className="text_input"
disabled={disabled}
id={id}
key={uniqueTextInputKey}
name={name}
onChange={onChange}
placeholder={placeholder}
Expand Down

0 comments on commit c116cab

Please # to comment.