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

Doc props like .constructor or .watch are lost in 3.2.1–3.6.0 #3968

Closed
ermouth opened this issue Jun 15, 2015 · 6 comments

Comments

@ermouth
Copy link
Contributor

commented Jun 15, 2015

Quite artificial example, but issue already took place ~year ago and was marked as fixed, see #2080

Repro: http://jquerymy.com/pouchdb/proploss2.html

Note, that result of the test is incorrect in all browsers, moreover result is different in FF and others.

@nolanlawson

This comment has been minimized.

Copy link
Member

commented Jun 15, 2015

Yeah, the reason we use that jQuery 1.9.0 version of extend is because other libraries that we tried have bugs with Ember due to their manipulation of the global Object prototype (#2158). I admit this is a bad bug, though, and needs to be fixed.

nolanlawson added a commit that referenced this issue Jun 15, 2015
@nolanlawson

This comment has been minimized.

Copy link
Member

commented Jun 15, 2015

@calvinmetcalf @daleharvey What is the solution here? Should we hack pouchdb-extend to keep these properties in, or should we just replace pouchdb-extend with JSON.parse(JSON.stringify(obj))? Personally I wouldn't mind the latter, because it would also fix those errors where people are surprised by IndexedDB's handling of Dates and other special types compared to the other adapters.

@calvinmetcalf

This comment has been minimized.

Copy link
Member

commented Jun 15, 2015

JSON.parse(JSON.stringify(obj)) is probably the easiest in all honesty

nolanlawson added a commit that referenced this issue Jun 15, 2015
@nolanlawson

This comment has been minimized.

Copy link
Member

commented Jun 15, 2015

^ I added a failing test, so anybody who would like to fix it is welcome to. :)

@ermouth

This comment has been minimized.

Copy link
Contributor Author

commented Jun 15, 2015

JSON.parse(JSON.stringify(obj)) solution is very fast, also this approach solves race issue #3955, but it‘s always a deep clone, so in cases of large docs there can be significant GC-induced stalls.

nolanlawson added a commit that referenced this issue Jun 15, 2015
@daleharvey daleharvey added the bug label Aug 4, 2015
daleharvey added a commit that referenced this issue Sep 4, 2015
daleharvey added a commit that referenced this issue Sep 5, 2015
@nolanlawson

This comment has been minimized.

Copy link
Member

commented Sep 5, 2015

fixed by 870248e

@nolanlawson nolanlawson closed this Sep 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.