javascript - PouchDB Update Document: DataCloneError -


this code have been working on while. reason, returning me following error:

uncaught datacloneerror: failed execute 'put' on 'idbobjectstore': object not cloned. 

this happening before tried use upsert plugin.

db.get(id).then(doc => {     console.log(doc);     return db.upsert(id, doc => {         doc.exp_date = moment(doc.exp_date).add(parseint(document.getelementbyid('ext_date').value), 'years');         return doc;     }).then(res => console.log(res)).catch(err => console.log(err)); }) 

may know resolution error?

the moment instance can't cloned. try:

postmessage(moment(0), '*'); // throws datacloneerror domexception 

the logic cloning disallows copying functions, may case. compare with:

postmessage({f: function(){}}); // throws datacloneerror 

and check:

typeof moment(0)._locale.ordinal; // "function" 

you'll need convert object returned add() can cloned, such date, number, etc.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -