@@ -56,9 +56,9 @@ export default function (WrappedComponent) {
56
56
const { group } = this . props ;
57
57
if ( portalNodes [ group ] ) {
58
58
59
+ // Other tooltip was active, switching
59
60
if ( portalNodes [ group ] . tips . length > 1 ) {
60
61
this . removeThisGroupTip ( ) ;
61
- // Other tooltip was active, switching
62
62
const item = portalNodes [ group ] . tips [ portalNodes [ group ] . tips . length - 1 ] ;
63
63
return item . renderPortal ( item . props ) ;
64
64
}
@@ -68,11 +68,10 @@ export default function (WrappedComponent) {
68
68
69
69
// Timeout to switch to next tooltip if necessary
70
70
portalNodes [ group ] . timeout = setTimeout ( ( ) => {
71
- if ( portalNodes [ group ] . tips . length === 1 ) {
71
+ if ( portalNodes [ group ] . tips . length === 0 ) {
72
72
ReactDOM . unmountComponentAtNode ( portalNodes [ group ] . el ) ;
73
73
delete portalNodes [ group ] ;
74
74
} else {
75
- this . removeThisGroupTip ( ) ;
76
75
const item = portalNodes [ group ] . tips [ portalNodes [ group ] . tips . length - 1 ] ;
77
76
item . renderPortal ( item . props ) ;
78
77
}
@@ -100,10 +99,14 @@ export default function (WrappedComponent) {
100
99
portalNodes [ group ] . timeout = null ;
101
100
}
102
101
103
- portalNodes [ group ] . tips = clearAll ? [ this ] : [
104
- ...this . removeThisGroupTip ( ) ,
105
- this ,
106
- ] ;
102
+ if ( props . active ) {
103
+ portalNodes [ group ] . tips = clearAll ? [ this ] : [
104
+ ...this . removeThisGroupTip ( ) ,
105
+ this ,
106
+ ] ;
107
+ } else {
108
+ this . removeThisGroupTip ( ) ;
109
+ }
107
110
108
111
ReactDOM . render ( < WrappedComponent { ...other } /> , portalNodes [ group ] . el ) ;
109
112
}
0 commit comments