File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
src/devtools/views/components Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -91,13 +91,13 @@ export default {
91
91
let instanceToSelect
92
92
93
93
if (key === LEFT ) {
94
- if (current .expanded ) {
94
+ if (current .expanded && current . $children . filter (isComponentInstance). length ) {
95
95
current .collapse ()
96
96
} else if (current .$parent && current .$parent .expanded ) {
97
97
instanceToSelect = current .$parent
98
98
}
99
99
} else if (key === RIGHT ) {
100
- if (current .expanded && current .$children .length ) {
100
+ if (current .expanded && current .$children .filter (isComponentInstance). length ) {
101
101
instanceToSelect = findByIndex (all, currentIndex + 1 )
102
102
} else {
103
103
current .expand ()
@@ -163,11 +163,15 @@ export default {
163
163
}
164
164
}
165
165
166
- function getAllInstances (list ) {
167
- return Array .prototype .concat .apply ([], list .map (instance => {
168
- return [instance, ... getAllInstances (instance .$children )]
169
- }))
170
- }
166
+ const isComponentInstance = object => typeof object !== ' undefined' && typeof object .instance !== ' undefined'
167
+
168
+ const getAllInstances = list => list .reduce ((instances , i ) => {
169
+ if (isComponentInstance (i)) {
170
+ instances .push (i)
171
+ }
172
+ instances = instances .concat (getAllInstances (i .$children ))
173
+ return instances
174
+ }, [])
171
175
172
176
function findCurrent (all , check ) {
173
177
for (let i = 0 ; i < all .length ; i++ ) {
You can’t perform that action at this time.
0 commit comments