Skip to content

Commit

Permalink
Resolves #2067. The issue happened specifically to delete-queries wit…
Browse files Browse the repository at this point in the history
…h a where-clause on primary key and where the condition had open ends (above, below - not between).
  • Loading branch information
David Fahlander committed Oct 14, 2024
1 parent 9d2497e commit 609e68b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/live-query/observability-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ export const observabilityMiddleware: Middleware<DBCore> = {
} else if (keys) {
// keys is a DBCoreKeyRange object. Transform it to [from,to]-style range.
// As we can't know deleted index ranges, mark index-based subscriptions must trigger.
const range = { from: keys.lower, to: keys.upper };
// (above/below-style ranges are not supported in RangeSet.ts, so we must replace open ends
// with core.MIN_KEY and core.MAX_KEY respectively. This is what solves issue #2067!
const range = {
from: keys.lower ?? core.MIN_KEY,
to: keys.upper ?? core.MAX_KEY
};
delsRangeSet.add(range);
// deleteRange. keys is a DBCoreKeyRange objects. Transform it to [from,to]-style range.
pkRangeSet.add(range);
Expand Down

0 comments on commit 609e68b

Please sign in to comment.