Repository navigation
fix: add async to the method using setFindOptions() - #10787
Conversation
WalkthroughEntityManager methods exists, count, countBy, findAndCount, and findAndCountBy were updated to explicitly use the async keyword in their declarations. Return types and internal logic remain unchanged; these methods still return Promises with the same types. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/entity-manager/EntityManager.ts (2)
1162-1173: findAndCountBy async is correct; parity maintainedNo further changes needed here.
If not already covered, add a small test asserting that an invalid options shape causes a rejected Promise (caught by
.catch/await) for each of these methods. I can help sketch such tests using a stubbed query builder if desired.
974-986: Async verified — approve; add CHANGELOG noteThe targeted methods in src/entity-manager/EntityManager.ts are async: exists, count, countBy, findAndCount, findAndCountBy (lines 974, 1005, 1023, 1143, 1162). Synchronous errors from setFindOptions(...) will now surface as Promise rejections; callers must use await + try/catch or .catch(...). Add a brief entry to docs/CHANGELOG stating that synchronous try/catch without await will no longer catch these errors.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/entity-manager/EntityManager.ts(5 hunks)
🔇 Additional comments (3)
src/entity-manager/EntityManager.ts (3)
1005-1017: Consistent async return semantics for countSame rationale as
exists; change is correct and low-risk.
1023-1031: countBy async-ification looks goodBrings behavior in line with runtime; keep as-is.
1143-1155: findAndCount now properly rejects via PromiseGood fix; matches
find/findBywhich were already async.
PR Code Suggestions ✨No code suggestions found for the PR. |
PR Code Suggestions ✨No code suggestions found for the PR. |
Co-authored-by: Giorgio Boa <[email protected]> Co-authored-by: Naor Peled <[email protected]>
Co-authored-by: Giorgio Boa <[email protected]> Co-authored-by: Naor Peled <[email protected]>
Description of change
Pull-Request Checklist
masterbranchnpm run formatto apply prettier formattingnpm run testpasses with this changeFixes #0000- N/ASummary by CodeRabbit