Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Fixed issue with selectedOption running on non-select fields
Browse files Browse the repository at this point in the history
  • Loading branch information
jamgregory committed Jun 17, 2020
1 parent acab03c commit b64087b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"edit",
"ajax"
],
"version": "0.6.5-2",
"version": "0.6.5-3",
"main": "dist/editable.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down
8 changes: 6 additions & 2 deletions src/Editable.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,12 @@ export default class Editable extends React.Component{
if(this.props.disabled){
p = value
}else{
const selectedOption = this.props.options.filter((option) => { return option.value === value });
a = (this.props.type === "select" ? selectedOption[0].label : value)
if (this.props.type === "select"){
const selectedOption = this.props.options.filter((option) => { return option.value === value });
a = selectedOption[0].label
} else {
a = value
}
}
}else{
p = value
Expand Down

0 comments on commit b64087b

Please sign in to comment.