File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -55,15 +55,29 @@ if (process.env.NODE_ENV !== 'production') {
55
55
const generateComponentTrace = vm => {
56
56
if ( vm . _isVue && vm . $parent && String . prototype . repeat ) {
57
57
const tree = [ ]
58
+ let currentRecursiveSequence = 0
58
59
while ( vm ) {
60
+ if ( tree . length > 0 ) {
61
+ const last = tree [ tree . length - 1 ]
62
+ if ( last . constructor === vm . constructor ) {
63
+ currentRecursiveSequence ++
64
+ vm = vm . $parent
65
+ continue
66
+ } else if ( currentRecursiveSequence > 0 ) {
67
+ tree [ tree . length - 1 ] = [ last , currentRecursiveSequence ]
68
+ currentRecursiveSequence = 0
69
+ }
70
+ }
59
71
tree . push ( vm )
60
72
vm = vm . $parent
61
73
}
62
74
return '\n\nfound in\n\n' + tree
63
75
. map ( ( vm , i ) => `${
64
76
i === 0 ? '---> ' : ' ' . repeat ( 5 + i * 2 )
65
77
} ${
66
- formatComponentName ( vm )
78
+ Array . isArray ( vm )
79
+ ? `${ formatComponentName ( vm [ 0 ] ) } ... (${ vm [ 1 ] } recursive calls)`
80
+ : formatComponentName ( vm )
67
81
} `)
68
82
. join ( '\n' )
69
83
} else {
You can’t perform that action at this time.
0 commit comments