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.
  • Loading branch information
David Fahlander committed Nov 15, 2024
1 parent 8e55011 commit d501d15
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 d501d15

Please sign in to comment.