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
Post a Comment