diff --git a/src/db.js b/src/db.js index dadc6be..f986102 100644 --- a/src/db.js +++ b/src/db.js @@ -135,11 +135,9 @@ var DB = (function () { await local.put(doc); // FIX: manually trigger map() callbacks for local update - // Call onChange BEFORE updating docCache so that onChange can detect the change + // onChange will update docCache and notify all subscribers onChange({ doc: doc }); - try { docCache[_id] = typeof doc.data === 'string' ? doc.data : JSON.stringify(doc.data); } catch (e) {} - } catch (e) { console.error('DB.put error', e); }