@atlaskit/tooltip
Advanced tools
Comparing version 12.1.13 to 12.1.14
# @atlaskit/tooltip | ||
## 12.1.14 | ||
- [patch] [8f179c4](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/8f179c4): | ||
- Remove scroll listener in componentWillMount in Tooltip to fix potential memory leak from 'close' tooltip not properly unmounting when hiding Examples modal via the X button | ||
## 12.1.13 | ||
@@ -4,0 +9,0 @@ - Updated dependencies [58b84fa](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/58b84fa): |
@@ -51,2 +51,7 @@ "use strict"; | ||
/* eslint-disable react/require-default-props */ | ||
var SCROLL_OPTIONS = { | ||
capture: true, | ||
passive: true | ||
}; | ||
function getMousePosition(mouseCoordinates) { | ||
@@ -205,2 +210,3 @@ var safeMouse = mouseCoordinates || { | ||
this.cancelPendingSetState(); | ||
this.removeScrollListener(); | ||
} | ||
@@ -210,16 +216,16 @@ }, { | ||
value: function componentDidUpdate(prevProps, prevState) { | ||
var scrollOptions = { | ||
capture: true, | ||
passive: true | ||
}; | ||
if (!prevState.isVisible && this.state.isVisible) { | ||
if (this.props.onShow) this.props.onShow(); | ||
window.addEventListener('scroll', this.handleWindowScroll, scrollOptions); | ||
window.addEventListener('scroll', this.handleWindowScroll, SCROLL_OPTIONS); | ||
} else if (prevState.isVisible && !this.state.isVisible) { | ||
if (this.props.onHide) this.props.onHide(); | ||
window.removeEventListener('scroll', this.handleWindowScroll, scrollOptions); | ||
this.removeScrollListener(); | ||
} | ||
} | ||
}, { | ||
key: "removeScrollListener", | ||
value: function removeScrollListener() { | ||
window.removeEventListener('scroll', this.handleWindowScroll, SCROLL_OPTIONS); | ||
} | ||
}, { | ||
key: "render", | ||
@@ -226,0 +232,0 @@ value: function render() { |
@@ -22,2 +22,6 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
import { hoveredPayload, unhoveredPayload } from './utils/analytics-payloads'; | ||
var SCROLL_OPTIONS = { | ||
capture: true, | ||
passive: true | ||
}; | ||
@@ -189,2 +193,3 @@ function getMousePosition(mouseCoordinates) { | ||
this.cancelPendingSetState(); | ||
this.removeScrollListener(); | ||
} | ||
@@ -194,16 +199,16 @@ }, { | ||
value: function componentDidUpdate(prevProps, prevState) { | ||
var scrollOptions = { | ||
capture: true, | ||
passive: true | ||
}; | ||
if (!prevState.isVisible && this.state.isVisible) { | ||
if (this.props.onShow) this.props.onShow(); | ||
window.addEventListener('scroll', this.handleWindowScroll, scrollOptions); | ||
window.addEventListener('scroll', this.handleWindowScroll, SCROLL_OPTIONS); | ||
} else if (prevState.isVisible && !this.state.isVisible) { | ||
if (this.props.onHide) this.props.onHide(); | ||
window.removeEventListener('scroll', this.handleWindowScroll, scrollOptions); | ||
this.removeScrollListener(); | ||
} | ||
} | ||
}, { | ||
key: "removeScrollListener", | ||
value: function removeScrollListener() { | ||
window.removeEventListener('scroll', this.handleWindowScroll, SCROLL_OPTIONS); | ||
} | ||
}, { | ||
key: "render", | ||
@@ -210,0 +215,0 @@ value: function render() { |
{ | ||
"name": "@atlaskit/tooltip", | ||
"version": "12.1.13", | ||
"version": "12.1.14", | ||
"sideEffects": false | ||
} |
{ | ||
"name": "@atlaskit/tooltip", | ||
"version": "12.1.13", | ||
"version": "12.1.14", | ||
"description": "A React Component for displaying Tooltips", | ||
@@ -41,2 +41,3 @@ "license": "Apache-2.0", | ||
"@atlaskit/icon": "^15.0.2", | ||
"@atlaskit/visual-regression": "^0.0.1", | ||
"enzyme": "^3.7.0", | ||
@@ -50,2 +51,2 @@ "react-dom": "^16.4.2" | ||
] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
81577
776
7