emberjs / ember.js

Ember.js - A JavaScript framework for creating ambitious web applications
https://emberjs.com
MIT License
22.47k stars 4.21k forks source link

ember seems to break indexedDB #4832

Closed calvinmetcalf closed 10 years ago

calvinmetcalf commented 10 years ago

try to put an object into indexedDB with PouchDB, if the object has an array in it, then you get an error, don't load ember or set ENV.EXTEND_PROTOTYPES = false and it goes in fine, my first guess would be that not all of the things added to the array prototype are properly set non-enumerable.

The error in question is:

code: 25
message: "Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned."
name: "DataCloneError"

js bin to reproduce it http://jsbin.com/vicofito/2/edit

see pouchdb/pouchdb#2158

calvinmetcalf commented 10 years ago

nope not a problem with enumerablilty

calvinmetcalf commented 10 years ago

but more generally looks like it's breaking the ability to structured clone something.

calvinmetcalf commented 10 years ago

though it does not break web workers from what I can tell, I don't know if structured cloning is implemented the same way for both

leepfrog commented 10 years ago

FWIW, I've used EmberJS with raw IndexedDB without an issue. See this pretty old gist: https://gist.github.com/leepfrog/5352059

calvinmetcalf commented 10 years ago

you are calling record.serialize on your objects before putting them into indexDB, that's all well and good for an ember app but doesn't deal with the fact that everything else using indexedDB is broken by ember being on the page.

knownasilya commented 10 years ago

@stefanpenner any ideas on this one?

stefanpenner commented 10 years ago

@knownasilya haven't had a chance to look into this yet. I'll try to find some time this weekend. Busy with client work right now.

wagenet commented 10 years ago

Closing due to inactivity. If this is still an issue, please let me know and I'll reopen.

stefanpenner commented 10 years ago

@calvinmetcalf is this still causing you guys issues?

calvinmetcalf commented 10 years ago

We changed to a different method of cloning objects and the problem went away, no idea about the root issue. On Nov 1, 2014 3:54 PM, "Stefan Penner" notifications@github.com wrote:

@calvinmetcalf https://github.com/calvinmetcalf is this still causing you guys issues?

— Reply to this email directly or view it on GitHub https://github.com/emberjs/ember.js/issues/4832#issuecomment-61380915.

stefanpenner commented 10 years ago

yay