Skip to content

Commit

Permalink
fix(VTreeView): null check when building tree from children (#13913)
Browse files Browse the repository at this point in the history
* This fixes children is undefined/null when doing "children.map" when given an undefined/null children value

* Changed the invalid check

* Changed back to a null coalesce operator

* Update packages/vuetify/src/components/VTreeview/VTreeview.ts

Co-authored-by: Jacek Karczmarczyk <[email protected]>
  • Loading branch information
JasonLandbridge and jacekkarczmarczyk authored Jul 30, 2021
1 parent 248add9 commit 0f71231
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VTreeview/VTreeview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export default mixins(
for (let i = 0; i < items.length; i++) {
const item = items[i]
const key = getObjectValueByPath(item, this.itemKey)
const children = getObjectValueByPath(item, this.itemChildren, [])
const children = getObjectValueByPath(item, this.itemChildren) ?? []
const oldNode = this.nodes.hasOwnProperty(key) ? this.nodes[key] : {
isSelected: false, isIndeterminate: false, isActive: false, isOpen: false, vnode: null,
} as NodeState
Expand Down

0 comments on commit 0f71231

Please sign in to comment.