Skip to content

Commit 1da1e9d

Browse files
committed
Merge pull request reduxjs#182 from dbrans/fix-todomvc-newTodo-blur
TodoMVC - Do not save onBlur if newTodo
2 parents 3d0476a + ebdd6db commit 1da1e9d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

examples/todomvc/components/TodoTextInput.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ export default class TodoTextInput extends Component {
3131
this.setState({ text: e.target.value });
3232
}
3333

34+
handleBlur(e) {
35+
if (!this.props.newTodo) {
36+
this.props.onSave(e.target.value);
37+
}
38+
}
39+
3440
render() {
3541
return (
3642
<input className={classnames({
@@ -41,7 +47,7 @@ export default class TodoTextInput extends Component {
4147
placeholder={this.props.placeholder}
4248
autoFocus='true'
4349
value={this.state.text}
44-
onBlur={(e) => this.props.onSave(e.target.value)}
50+
onBlur={::this.handleBlur}
4551
onChange={::this.handleChange}
4652
onKeyDown={::this.handleSubmit} />
4753
);

0 commit comments

Comments
 (0)