Skip to content

Commit

Permalink
fix: infinite loop on ref set
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Apr 22, 2019
1 parent bcbf904 commit 29e9691
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ class FocusLock extends Component {

onBlur = onBlur;

setObserveNode = observed =>
this.setState({
observed,
});
setObserveNode = (observed) => {
if (this.state.observed !== observed) {
this.setState({
observed,
});
}
};

// active status is tracked outside React state
isActive = false;
Expand Down

0 comments on commit 29e9691

Please sign in to comment.