Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue.js __ob__ (Observer) lost #122

Closed
ibyteyou opened this issue Oct 4, 2018 · 6 comments
Closed

vue.js __ob__ (Observer) lost #122

ibyteyou opened this issue Oct 4, 2018 · 6 comments

Comments

@ibyteyou
Copy link

ibyteyou commented Oct 4, 2018

analogue #76
2018-10-04 14 18 19

need reproduction?
maybe it's must be controlled for performance? re clone option?
as expected { clone: true } must repeat this behavior,
and { clone: false } must save alias __ob__

@TehShrike
Copy link
Owner

TehShrike commented Oct 4, 2018

deepmerge uses Object.keys to iterate over properties:

https://github.com/KyleAMathews/deepmerge/blob/0f5efc82da76c6aed892131a11bb967e86cd9717/index.js#L22

Object.keys only iterates over properties that are

  • enumerable
  • on the object directly, as opposed to somewhere up the prototype chain

I'm going to guess that __ob__ doesn't meet one of those checks.

@TehShrike
Copy link
Owner

(You can use propertyIsEnumerable and hasOwnProperty to confirm)

@ibyteyou
Copy link
Author

ibyteyou commented Oct 5, 2018

@TehShrike

__ob__.propertyIsEnumerable() => false
__ob__.hasOwnProperty() => false

@ibyteyou
Copy link
Author

ibyteyou commented Oct 5, 2018

internal structure of __ob__:

Observer {
  dep: Dep {
    id: 16650
    subs: [] // array with vue reactive dependences
  },
  value: {}, // alias to root
  vmCount: 0
}

@TehShrike
Copy link
Owner

@ibyteyou
Copy link
Author

ibyteyou commented Oct 5, 2018

oh 😛sorry)

propertyIsEnumerable('__ob__') => false
hasOwnProperty('__ob__') => true

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

No branches or pull requests

2 participants