Skip to content

Commit

Permalink
Merge 430aa83 into 6c780ae
Browse files Browse the repository at this point in the history
  • Loading branch information
fuller committed Jun 19, 2017
2 parents 6c780ae + 430aa83 commit 695c782
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ export default class Modal extends Component {
}

componentWillReceiveProps(newProps) {
if (newProps.isOpen) refCount.add(this);
if (!newProps.isOpen) refCount.remove(this);
const { isOpen } = newProps;
// Stop unnecessary renders if modal is remaining closed
if (!this.props.isOpen && !isOpen) return;

if (isOpen) refCount.add(this);
if (!isOpen) refCount.remove(this);
const currentParent = getParentElement(this.props.parentSelector);
const newParent = getParentElement(newProps.parentSelector);

Expand Down

0 comments on commit 695c782

Please sign in to comment.