diff --git a/assets/javascripts/app/db.coffee b/assets/javascripts/app/db.coffee index a88c6d06..1a4c4da1 100644 --- a/assets/javascripts/app/db.coffee +++ b/assets/javascripts/app/db.coffee @@ -84,9 +84,11 @@ class app.DB return txn.onerror = (event) => event.preventDefault() - if txn.error.name is 'NotFoundError' and _retry + if txn.error?.name is 'NotFoundError' and _retry @migrate() - @store(doc, data, onSuccess, onError, false) + setTimeout => + @store(doc, data, onSuccess, onError, false) + , 0 else onError(event) return @@ -113,9 +115,11 @@ class app.DB return txn.onerror = (event) -> event.preventDefault() - if txn.error.name is 'NotFoundError' and _retry + if txn.error?.name is 'NotFoundError' and _retry @migrate() - @unstore(doc, onSuccess, onError, false) + setTimeout => + @unstore(doc, onSuccess, onError, false) + , 0 else onError(event) return