Skip to content

Commit

Permalink
fix(setData): allow empty objects to be set
Browse files Browse the repository at this point in the history
fixes vuejs#1704 

This is a tentative fix to show one possible solution, I can clean it up if you think it makes sense
  • Loading branch information
Haroenv committed Oct 1, 2020
1 parent a821908 commit cda6e4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/test-utils/src/recursively-set-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function recursivelySetData(vm, target, data) {
const val = data[key]
const targetVal = target[key]

if (isPlainObject(val) && isPlainObject(targetVal)) {
if (isPlainObject(val) && isPlainObject(targetVal) && Object.keys(val).length > 0) {
recursivelySetData(vm, targetVal, val)
} else {
vm.$set(target, key, val)
Expand Down

0 comments on commit cda6e4b

Please sign in to comment.