Skip to content

Commit

Permalink
fix: collection filtering condition (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
darkbasic authored Dec 5, 2023
1 parent 01c8a3b commit 6229c18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/yellow-wolves-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"mikro-orm-find-dataloader": patch
---

fix: collection filtering condition
4 changes: 3 additions & 1 deletion packages/find/src/findDataloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,9 @@ export function getFindBatchLoadFn<Entity extends object>(
} else {
// Our current filter is an object
if (entityValue instanceof Collection) {
entityValue.find((entity) => filterResult(entity, value));
if (!entityValue.getItems().some((entity) => filterResult(entity, value))) {
return false;
}
} else if (!filterResult(entityValue as object, value)) {
return false;
}
Expand Down

0 comments on commit 6229c18

Please sign in to comment.