Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
riophae committed Jun 24, 2018
1 parent d63536d commit d7f57d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
17 changes: 10 additions & 7 deletions src/mixins/treeselectMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
onlyOnLeftClick, scrollIntoView,
isNaN, isPromise, once,
identity, constant, createMap,
assign,
quickDiff, getLast, includes, find, removeFromArray,
} from '../utils'

Expand Down Expand Up @@ -973,9 +972,10 @@ export default {
// It could be useful for async search mode.
this.forest.selectedNodeIds.forEach(id => {
if (!prevNodeMap[id]) return
const fallbackNode = assign({}, prevNodeMap[id], {
const fallbackNode = {
...prevNodeMap[id],
isFallbackNode: true,
})
}
this.$set(this.forest.nodeMap, id, fallbackNode)
})
},
Expand Down Expand Up @@ -1330,7 +1330,10 @@ export default {
},

enhancedNormalizer(raw) {
return assign({}, raw, this.normalizer(raw, this.getInstanceId()))
return {
...raw,
...this.normalizer(raw, this.getInstanceId()),
}
},

normalize(parentNode, nodes, prevNodeMap) {
Expand All @@ -1347,7 +1350,8 @@ export default {
const isLeaf = !isBranch
const isDisabled = !!node.isDisabled || (!this.flat && !isRootNode && parentNode.isDisabled)
const isNew = !!node.isNew
const lowerCased = this.matchKeys.reduce((prev, key) => assign(prev, {
const lowerCased = this.matchKeys.reduce((prev, key) => ({
...prev,
[key]: stringifyOptionPropValue(node[key]).toLocaleLowerCase(),
}), {})
const nestedSearchLabel = isRootNode
Expand Down Expand Up @@ -1418,8 +1422,7 @@ export default {
if (prev.isBranch && normalized.isBranch) {
normalized.isExpanded = prev.isExpanded
normalized.isExpandedOnSearch = prev.isExpandedOnSearch
normalized.isPending = prev.isPending
normalized.loadingChildrenError = prev.loadingChildrenError
normalized.childrenStates = { ...prev.childrenStates }
}
}

Expand Down
17 changes: 0 additions & 17 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,6 @@ function copy(obj, key, value) {
}
}

function hasOwn(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key)
}

export function assign(target, ...sources) {
for (let i = 0; i < sources.length; i++) {
const source = sources[i]
for (const key in source) {
// istanbul ignore else
if (hasOwn(source, key)) {
target[key] = source[key]
}
}
}
return target
}

export function deepExtend(target, source) {
if (isPlainObject(source)) {
const keys = Object.keys(source)
Expand Down

0 comments on commit d7f57d4

Please sign in to comment.