Skip to content

Commit

Permalink
Bugfix: Resolution for #1946 was incorrect. This commit should solve …
Browse files Browse the repository at this point in the history
…it for good. (#2096)

Co-authored-by: David Fahlander <david@dexie.org>
  • Loading branch information
dfahlander and David Fahlander authored Nov 15, 2024
1 parent 7ec8ce3 commit 527ac54
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/live-query/observability-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ export const observabilityMiddleware: Middleware<DBCore> = {
// Find the position of the primary key in the index:
const pkPos = (idx.keyPath as string[]).findIndex(prop => prop === primaryKey.keyPath);
// Update idxVals with the resulting primary keys to complete the index value:
res.results!.forEach(pk => idxVals[pkPos] = pk);
for (let i = 0, len = res.results!.length; i < len; ++i) {
idxVals[i][pkPos] = res.results![i];
}
// Add the updated index to the rangeset:
getRangeSet(idx.name).addKeys(idxVals);
});
Expand Down

0 comments on commit 527ac54

Please sign in to comment.