Skip to content

Commit

Permalink
Prevent blank edit-in-place value (#3557)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranbena authored Mar 11, 2019
1 parent 63d3f22 commit 93ec19b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/app/components/EditInPlace.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { react2angular } from 'react2angular';
import { trim } from 'lodash';

export class EditInPlace extends React.Component {
static propTypes = {
Expand Down Expand Up @@ -40,7 +41,7 @@ export class EditInPlace extends React.Component {
};

stopEditing = () => {
const newValue = this.inputRef.current.value;
const newValue = trim(this.inputRef.current.value);
const ignorableBlank = this.props.ignoreBlanks && newValue === '';
if (!ignorableBlank && newValue !== this.props.value) {
this.props.onDone(newValue);
Expand Down

0 comments on commit 93ec19b

Please sign in to comment.