mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-24 08:04:11 +08:00
fix(popover): Add isMounted check, Sentry 20951
This commit is contained in:
parent
3fa93c2730
commit
b05ea801b0
1 changed files with 7 additions and 0 deletions
|
@ -45,6 +45,7 @@ class FixedPopover extends Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
this.mounted = false;
|
||||||
this.updateCount = 0
|
this.updateCount = 0
|
||||||
this.fallback = this.props.fallbackDirection;
|
this.fallback = this.props.fallbackDirection;
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -55,6 +56,7 @@ class FixedPopover extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.mounted = true;
|
||||||
window.addEventListener('resize', this.onWindowResize)
|
window.addEventListener('resize', this.onWindowResize)
|
||||||
this.focusElementWithTabIndex();
|
this.focusElementWithTabIndex();
|
||||||
_.defer(this.onPopoverRendered)
|
_.defer(this.onPopoverRendered)
|
||||||
|
@ -78,6 +80,7 @@ class FixedPopover extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
this.mounted = false;
|
||||||
window.removeEventListener('resize', this.onWindowResize)
|
window.removeEventListener('resize', this.onWindowResize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +89,10 @@ class FixedPopover extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onPopoverRendered = ()=> {
|
onPopoverRendered = ()=> {
|
||||||
|
if (!this.mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const {direction} = this.state
|
const {direction} = this.state
|
||||||
const currentRect = this.getCurrentRect()
|
const currentRect = this.getCurrentRect()
|
||||||
const windowDimensions = this.getWindowDimensions()
|
const windowDimensions = this.getWindowDimensions()
|
||||||
|
|
Loading…
Reference in a new issue