Skip to content

Commit 1cf563f

Browse files
author
James Burnett
committed
fixed bug that would cause error if waiting to update while the component disappeared
1 parent f2bae68 commit 1cf563f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.jshintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"node": true,
3+
"browser": true,
4+
"esnext": true,
5+
"laxcomma": true
6+
}

index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,20 @@ var LazyInput = React.createClass({
1212
return {
1313
type: 'text',
1414
lazyLevel: 1000
15-
}
15+
};
1616
},
1717
getInitialState: function() {
1818
return { value: this.props.value };
1919
},
2020
componentWillReceiveProps: function(nextProps) {
2121
this.updateIfNotLazy(nextProps.value);
2222
},
23+
componentWillUnmount: function() {
24+
if(this.procrastinationTimer) {
25+
clearTimeout(this.procrastinationTimer);
26+
this.procrastinating = false;
27+
}
28+
},
2329
updateIfNotLazy: function(newValue) {
2430
if(!this.procrastinating) {
2531
this.setState({ value: newValue, requestedValue: undefined });

0 commit comments

Comments
 (0)