Skip to content

Commit ffee13d

Browse files
Pwntusmarcosmoura
authored andcommitted
fix(MdApp): child.data.attrs is undefined (#1762)
* fix(MdApp): TypeError: child.data.attrs is undefined * fix(MdApp): add generateAttrKeys function to adhere ESLint complexity limit of 6 (#1741)
1 parent 0fe05ac commit ffee13d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/components/MdApp/MdApp.vue

+9-4
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,21 @@
3030
return (data && componentTypes.includes(data.slot)) || isValidChild(componentOptions)
3131
}
3232
33+
function generateAttrKeys (attrs) {
34+
return JSON.stringify({
35+
'persistent': attrs && attrs['md-persistent'],
36+
'permanent': attrs && attrs['md-permanent']
37+
})
38+
}
39+
3340
function buildSlots (children, context, functionalContext, options, createElement) {
3441
let slots = []
3542
3643
let hasDrawer = false
3744
3845
if (children) {
3946
children.forEach(child => {
47+
/* eslint-enable */
4048
const data = child.data
4149
const componentOptions = child.componentOptions
4250
@@ -53,10 +61,7 @@
5361
5462
hasDrawer = true
5563
child.data.slot += `-${isRight ? 'right' : 'left'}`
56-
child.key = JSON.stringify({
57-
'persistent': child.data.attrs['md-persistent'],
58-
'permanent': child.data.attrs['md-permanent']
59-
})
64+
child.key = generateAttrKeys(data.attrs)
6065
6166
createRightDrawer(isRight)
6267
}

0 commit comments

Comments
 (0)