Skip to content

Conversation

eddyerburgh
Copy link
Member

  • Handle data set from null to an object

Closes #888

const targetVal = target[key]

if (isPlainObject(val) && isPlainObject(targetVal)) {
recursivelySetData(vm, targetVal, val)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like you just add a check to see if targetVal is a plain object, why does this solve the problem?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null isn't a plain object, so we call Vue.set on the target property, rather than recursively setting.

@eddyerburgh eddyerburgh merged commit 44c4520 into vuejs:dev Aug 4, 2018
@eddyerburgh eddyerburgh deleted the fix-set-data branch August 4, 2018 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants