File tree 2 files changed +10
-4
lines changed
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ const handlers = {
55
55
56
56
function tooltip ( state = initial , action ) {
57
57
// Check usage of deprecated props
58
- deprecatedWarning ( action . payload ) ;
58
+ deprecatedWarning ( action ) ;
59
59
60
60
const handler = handlers [ action . type ] ;
61
61
return handler ? handler ( state , action ) : state ;
Original file line number Diff line number Diff line change 1
1
import isDOM from 'is-dom' ;
2
+ import * as actions from './actions' ;
2
3
3
4
function dimension ( el ) {
4
5
const rect = el . getBoundingClientRect ( ) ;
@@ -235,11 +236,16 @@ export function resolve(obj) {
235
236
return names ;
236
237
}
237
238
238
- export function deprecatedWarning ( props ) {
239
- if ( props && props . el ) {
239
+ const actionTypes = Object . keys ( actions ) . map ( k => actions [ k ] ) . filter ( e => typeof e === 'string' ) ;
240
+ export function deprecatedWarning ( action ) {
241
+ const { type, payload } = action ;
242
+ if ( actionTypes . indexOf ( action . type ) === - 1 ) {
243
+ return ; // Ignore non-related actions
244
+ }
245
+ if ( payload && payload . el ) {
240
246
console . warn ( `DEPRECATED: Use 'origin' instead of 'el' in props for Tooltip component or 'show' action.` ) ;
241
247
}
242
- if ( props && props . el && props . origin ) {
248
+ if ( payload && payload . el && payload . origin ) {
243
249
console . warn ( `Do not pass both 'origin' and 'el' props at the same time.` ) ;
244
250
}
245
251
}
You can’t perform that action at this time.
0 commit comments