Skip to content

Commit b87e324

Browse files
Add assert
1 parent 00df97d commit b87e324

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

packages/firestore/src/local/indexeddb_index_manager.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,10 @@ export class IndexedDbIndexManager implements IndexManager {
857857
// that we would split an existing range into multiple ranges that exclude
858858
// the values from any notIn filter.
859859
for (const indexRange of indexRanges) {
860+
debugAssert(
861+
indexRange.lower[0] === indexRange.upper[0],
862+
'Index ID must match for index range'
863+
);
860864
const lowerBound = new Uint8Array(indexRange.lower[3]);
861865
const upperBound = new Uint8Array(indexRange.upper[3]);
862866

@@ -873,7 +877,7 @@ export class IndexedDbIndexManager implements IndexManager {
873877
ranges.push(
874878
IDBKeyRange.bound(
875879
this.generateBound(indexRange.lower, lastBound),
876-
this.generateBound(indexRange.lower, currentBound),
880+
this.generateBound(indexRange.upper, currentBound),
877881
lastOpen,
878882
/* upperOpen= */ indexRange.upperOpen
879883
)

packages/firestore/test/unit/local/index_manager.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,18 @@ describe('IndexedDbIndexManager', async () => {
446446
await verifyResults(q, 'coll/val2', 'coll/val3');
447447
});
448448

449+
it('applies startAt filter with notIn', async () => {
450+
await setUpSingleValueFilter();
451+
const q = queryWithStartAt(
452+
queryWithAddedOrderBy(
453+
queryWithAddedFilter(query('coll'), filter('count', '!=', 2)),
454+
orderBy('count')
455+
),
456+
bound([2], true)
457+
);
458+
await verifyResults(q, 'coll/val3');
459+
});
460+
449461
it('applies startAfter filter', async () => {
450462
await setUpSingleValueFilter();
451463
const q = queryWithStartAt(

0 commit comments

Comments
 (0)