fix(dal-gen): await async loader.load() for egg4 compatibility#295
fix(dal-gen): await async loader.load() for egg4 compatibility#295elrrrrrrr wants to merge 1 commit into
Conversation
In egg4 the tegg loader's `load()` is async and returns a Promise, but `lib/dal-gen.js` consumed it synchronously, so `for (const clazz of clazzList)` threw `TypeError: clazzList is not iterable` during `egg-bin generate dal code`. (`@eggjs/dal-runtime`'s own DaoLoader already awaits it.) Await the loader. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request updates lib/dal-gen.js to correctly await the asynchronous loader.load() function call when retrieving the list of classes. There are no review comments, and I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 5.x #295 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 12 8 -4
Lines 93 60 -33
Branches 16 12 -4
=========================================
- Hits 93 60 -33 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What
In egg4 the tegg loader's
load()is async (returns aPromise), butlib/dal-gen.jsconsumed it synchronously:So
egg-bin generate dal code <module>fails withclazzList is not iterableagainst egg4 /@eggjs/tegg@4. Note@eggjs/dal-runtime's ownDaoLoaderalready awaits.load().Fix
The call site is already inside an
asyncIIFE, so this is safe. Targeting5.xsince thedalcommand only exists on the 5.x line.🤖 Generated with Claude Code