@atlaskit/tooltip
Advanced tools
Comparing version
# @atlaskit/tooltip | ||
## 9.1.3 | ||
- [patch] Fix react warnings caused when unmounting a tooltip when it is queued for show/hide [6d9cc52](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/6d9cc52) | ||
## 9.1.2 | ||
@@ -4,0 +7,0 @@ - [patch] Fix tooltip scroll listeners not being removed properly and an edgecase viewport autoflip issue [0a3ccc9](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/0a3ccc9) |
@@ -47,2 +47,9 @@ 'use strict'; | ||
} | ||
/** | ||
* Queue a tooltip for showing. | ||
* | ||
* This should be called from Tooltip directly. | ||
*/ | ||
}, { | ||
@@ -58,3 +65,3 @@ key: 'show', | ||
if (this.queuedForShow) { | ||
this.clearShowTimeout(); | ||
this.clearShowTimeout(this.queuedForShow); | ||
} | ||
@@ -64,5 +71,3 @@ | ||
if (this.visibleTooltip === tooltip) { | ||
if (this.queuedForHide === tooltip) { | ||
this.clearHideTimeout(); | ||
} | ||
this.clearHideTimeout(tooltip); | ||
return; | ||
@@ -75,5 +80,3 @@ } | ||
// the visible tooltip may be queued to be hidden; prevent that | ||
if (this.queuedForHide) { | ||
this.clearHideTimeout(); | ||
} | ||
this.clearHideTimeout(this.visibleTooltip); | ||
// immediately hide the old tooltip and show the new one | ||
@@ -91,2 +94,9 @@ this.showTooltip(tooltip, { immediate: true }); | ||
} | ||
/** | ||
* Performs the action of showing the tooltip. | ||
* | ||
* This is an internal method and should not be called directly. | ||
*/ | ||
}, { | ||
@@ -106,7 +116,8 @@ key: 'showTooltip', | ||
key: 'clearShowTimeout', | ||
value: function clearShowTimeout() { | ||
if (this.showTimeout) { | ||
value: function clearShowTimeout(tooltip) { | ||
if (this.showTimeout && this.queuedForShow === tooltip) { | ||
clearTimeout(this.showTimeout); | ||
this.queuedForShow = null; | ||
this.showTimeout = null; | ||
} | ||
this.showTimeout = null; | ||
} | ||
@@ -163,2 +174,9 @@ }, { | ||
key: 'hide', | ||
/** | ||
* Queue a tooltip for hiding. | ||
* | ||
* This should be called from Tooltip directly. | ||
*/ | ||
value: function hide(tooltip) { | ||
@@ -172,4 +190,3 @@ var _this3 = this; | ||
if (this.queuedForShow === tooltip) { | ||
this.clearShowTimeout(); | ||
this.queuedForShow = null; | ||
this.clearShowTimeout(tooltip); | ||
return; | ||
@@ -188,2 +205,9 @@ } | ||
} | ||
/** | ||
* Performs the action of hiding the tooltip. | ||
* | ||
* This is an internal method and should not be called directly. | ||
*/ | ||
}, { | ||
@@ -203,9 +227,26 @@ key: 'hideTooltip', | ||
key: 'clearHideTimeout', | ||
value: function clearHideTimeout() { | ||
if (this.hideTimeout) { | ||
value: function clearHideTimeout(tooltip) { | ||
if (this.hideTimeout && this.queuedForHide === tooltip) { | ||
clearTimeout(this.hideTimeout); | ||
this.queuedForHide = null; | ||
this.hideTimeout = null; | ||
} | ||
this.queuedForHide = null; | ||
} | ||
/** | ||
* Called by a tooltip on unmount. | ||
* Remove tooltip from any show/hide queues and remove any scroll listeners | ||
*/ | ||
}, { | ||
key: 'unmount', | ||
value: function unmount(tooltip) { | ||
this.clearShowTimeout(tooltip); | ||
this.clearHideTimeout(tooltip); | ||
if (this.visibleTooltip === tooltip) { | ||
this.removeScrollListener(tooltip); | ||
this.visibleTooltip = null; | ||
} | ||
} | ||
// Used to cleanup unit tests | ||
@@ -212,0 +253,0 @@ |
@@ -175,2 +175,7 @@ 'use strict'; | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
marshal.unmount(this); | ||
} | ||
}, { | ||
key: 'renderTooltip', | ||
@@ -177,0 +182,0 @@ value: function renderTooltip() { |
@@ -36,2 +36,9 @@ import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; | ||
} | ||
/** | ||
* Queue a tooltip for showing. | ||
* | ||
* This should be called from Tooltip directly. | ||
*/ | ||
}, { | ||
@@ -47,3 +54,3 @@ key: 'show', | ||
if (this.queuedForShow) { | ||
this.clearShowTimeout(); | ||
this.clearShowTimeout(this.queuedForShow); | ||
} | ||
@@ -53,5 +60,3 @@ | ||
if (this.visibleTooltip === tooltip) { | ||
if (this.queuedForHide === tooltip) { | ||
this.clearHideTimeout(); | ||
} | ||
this.clearHideTimeout(tooltip); | ||
return; | ||
@@ -64,5 +69,3 @@ } | ||
// the visible tooltip may be queued to be hidden; prevent that | ||
if (this.queuedForHide) { | ||
this.clearHideTimeout(); | ||
} | ||
this.clearHideTimeout(this.visibleTooltip); | ||
// immediately hide the old tooltip and show the new one | ||
@@ -80,2 +83,9 @@ this.showTooltip(tooltip, { immediate: true }); | ||
} | ||
/** | ||
* Performs the action of showing the tooltip. | ||
* | ||
* This is an internal method and should not be called directly. | ||
*/ | ||
}, { | ||
@@ -95,7 +105,8 @@ key: 'showTooltip', | ||
key: 'clearShowTimeout', | ||
value: function clearShowTimeout() { | ||
if (this.showTimeout) { | ||
value: function clearShowTimeout(tooltip) { | ||
if (this.showTimeout && this.queuedForShow === tooltip) { | ||
clearTimeout(this.showTimeout); | ||
this.queuedForShow = null; | ||
this.showTimeout = null; | ||
} | ||
this.showTimeout = null; | ||
} | ||
@@ -152,2 +163,9 @@ }, { | ||
key: 'hide', | ||
/** | ||
* Queue a tooltip for hiding. | ||
* | ||
* This should be called from Tooltip directly. | ||
*/ | ||
value: function hide(tooltip) { | ||
@@ -161,4 +179,3 @@ var _this3 = this; | ||
if (this.queuedForShow === tooltip) { | ||
this.clearShowTimeout(); | ||
this.queuedForShow = null; | ||
this.clearShowTimeout(tooltip); | ||
return; | ||
@@ -177,2 +194,9 @@ } | ||
} | ||
/** | ||
* Performs the action of hiding the tooltip. | ||
* | ||
* This is an internal method and should not be called directly. | ||
*/ | ||
}, { | ||
@@ -192,9 +216,26 @@ key: 'hideTooltip', | ||
key: 'clearHideTimeout', | ||
value: function clearHideTimeout() { | ||
if (this.hideTimeout) { | ||
value: function clearHideTimeout(tooltip) { | ||
if (this.hideTimeout && this.queuedForHide === tooltip) { | ||
clearTimeout(this.hideTimeout); | ||
this.queuedForHide = null; | ||
this.hideTimeout = null; | ||
} | ||
this.queuedForHide = null; | ||
} | ||
/** | ||
* Called by a tooltip on unmount. | ||
* Remove tooltip from any show/hide queues and remove any scroll listeners | ||
*/ | ||
}, { | ||
key: 'unmount', | ||
value: function unmount(tooltip) { | ||
this.clearShowTimeout(tooltip); | ||
this.clearHideTimeout(tooltip); | ||
if (this.visibleTooltip === tooltip) { | ||
this.removeScrollListener(tooltip); | ||
this.visibleTooltip = null; | ||
} | ||
} | ||
// Used to cleanup unit tests | ||
@@ -201,0 +242,0 @@ |
@@ -139,2 +139,7 @@ import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of'; | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
marshal.unmount(this); | ||
} | ||
}, { | ||
key: 'renderTooltip', | ||
@@ -141,0 +146,0 @@ value: function renderTooltip() { |
{ | ||
"name": "@atlaskit/tooltip", | ||
"version": "9.1.1" | ||
"version": "9.1.2" | ||
} |
{ | ||
"name": "@atlaskit/tooltip", | ||
"version": "9.1.2", | ||
"version": "9.1.3", | ||
"description": "A React Component for displaying Tooltips", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
141243
3.22%1822
4.11%