Skip to content

Commit

Permalink
fix(editor): fix undo for fields with null values
Browse files Browse the repository at this point in the history
fixes #113
  • Loading branch information
landonreed committed May 6, 2018
1 parent 7c55e34 commit b9edff9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/editor/components/EditorInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,15 @@ export default class EditorInput extends Component {
case 'GTFS_BLOCK':
case 'GTFS_FARE':
case 'GTFS_SERVICE':
// Ensure that an empty string is passed to value prop, so that on 'undo'
// the input value will revert back to a blank field.
const stringValue = typeof fieldProps.value === 'undefined'
? ''
: fieldProps.value
return (
<FormGroup {...formProps}>
{basicLabel}
<FormControl {...fieldProps} />
<FormControl {...fieldProps} value={stringValue} />
</FormGroup>
)
case 'URL':
Expand Down

0 comments on commit b9edff9

Please sign in to comment.