Skip to content

Commit 7b23c81

Browse files
authored
adapter-indexeddb: use isLocalId() (#8883)
Co-authored-by: alxndrsn <alxndrsn>
1 parent 3deef61 commit 7b23c81

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎packages/node_modules/pouchdb-adapter-indexeddb/src/allDocs.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
import { isLocalId } from 'pouchdb-adapter-utils';
34
import { createError, IDB_ERROR } from 'pouchdb-errors';
45
import { collectConflicts } from 'pouchdb-merge';
56

@@ -205,7 +206,7 @@ export default function (txn, metadata, opts, callback) {
205206
if (!doc) { return; }
206207

207208
// Skip local docs
208-
if (doc.id.startsWith('_local/')) {
209+
if (isLocalId(doc.id)) {
209210
return e.target.result.continue();
210211
}
211212

‎packages/node_modules/pouchdb-adapter-indexeddb/src/bulkDocs.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
blobOrBufferToBase64 as blufferToBase64,
1616
} from 'pouchdb-binary-utils';
1717

18-
import { parseDoc } from 'pouchdb-adapter-utils';
18+
import { isLocalId, parseDoc } from 'pouchdb-adapter-utils';
1919
import { binaryMd5 as md5 } from 'pouchdb-md5';
2020
import { winningRev as calculateWinningRev, merge, compactTree } from 'pouchdb-merge';
2121

@@ -39,7 +39,7 @@ export default function (api, req, opts, metadata, dbOpts, idbChanges, callback)
3939

4040
// We only need to track 1 revision for local documents
4141
function docsRevsLimit(doc) {
42-
return doc.id.startsWith('_local/') ? 1 : revsLimit;
42+
return isLocalId(doc.id) ? 1 : revsLimit;
4343
}
4444

4545
function rootIsMissing(doc) {
@@ -187,7 +187,7 @@ export default function (api, req, opts, metadata, dbOpts, idbChanges, callback)
187187
var winningRev = calculateWinningRev(doc);
188188
// rev of new doc for attachments and to return it
189189
var writtenRev = doc.rev;
190-
var isLocal = doc.id.startsWith('_local/');
190+
const isLocal = isLocalId(doc.id);
191191

192192
var theDoc = doc.revs[winningRev].data;
193193

0 commit comments

Comments
 (0)