Skip to content

Commit 99f20e5

Browse files
authored
indexeddb.getAttachment: don't open unnecessary transaction (#8786)
1 parent 4f45948 commit 99f20e5

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

packages/node_modules/pouchdb-adapter-indexeddb/src/getAttachment.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22

33
import { btoa, readAsBinaryString } from 'pouchdb-binary-utils';
44

5-
export default function getAttachment(txn, docId, attachId, attachment, opts, cb) {
6-
if (txn.error) {
7-
return cb(txn.error);
8-
}
9-
5+
export default function getAttachment(docId, attachId, attachment, opts, cb) {
106
const doc = opts.metadata;
117
const data = doc.attachments[attachment.digest].data;
128

packages/node_modules/pouchdb-adapter-indexeddb/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function IndexeddbPouch(dbOpts, callback) {
118118
allDocs(txn, metadata, opts, cb);
119119
});
120120

121-
api._getAttachment = $t(getAttachment);
121+
api._getAttachment = getAttachment;
122122

123123
api._changes = $t(function (txn, opts) {
124124
changes(txn, idbChanges, api, dbOpts, opts);

0 commit comments

Comments
 (0)