fix(popover): Add isMounted check, Sentry 20951

This commit is contained in:
Ben Gotow 2016-03-24 17:18:24 -07:00
parent 3fa93c2730
commit b05ea801b0

View file

@ -45,6 +45,7 @@ class FixedPopover extends Component {
constructor(props) {
super(props);
this.mounted = false;
this.updateCount = 0
this.fallback = this.props.fallbackDirection;
this.state = {
@ -55,6 +56,7 @@ class FixedPopover extends Component {
}
componentDidMount() {
this.mounted = true;
window.addEventListener('resize', this.onWindowResize)
this.focusElementWithTabIndex();
_.defer(this.onPopoverRendered)
@ -78,6 +80,7 @@ class FixedPopover extends Component {
}
componentWillUnmount() {
this.mounted = false;
window.removeEventListener('resize', this.onWindowResize)
}
@ -86,6 +89,10 @@ class FixedPopover extends Component {
}
onPopoverRendered = ()=> {
if (!this.mounted) {
return;
}
const {direction} = this.state
const currentRect = this.getCurrentRect()
const windowDimensions = this.getWindowDimensions()