⚡ Bolt: optimize admin categories query#186
Conversation
- Refactor admin categories load function to use a single SQL query with LEFT JOIN and GROUP BY for counting moves. - Fix missing 'level' column in scripts/init-db.ts to resolve home page crashes. - Add .jules/bolt.md with performance and schema learnings. Co-authored-by: bbaaxx <3812307+bbaaxx@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What: Optimized the admin categories list by replacing a redundant
db.batchcall and manual in-memory counting with a single SQL aggregation query usingLEFT JOINandGROUP BY. Additionally, fixed a schema mismatch inscripts/init-db.tswhere thelevelcolumn was missing from themovestable, causing home page crashes.🎯 Why: The previous implementation fetched all categories and then all moves to merge them in the application layer, which is inefficient as the data grows. Offloading this to the database reduces network overhead and CPU usage. The schema fix ensures the local development environment correctly reflects the application's data requirements.
📊 Impact:
🧪 Measurement: Verified via Playwright screenshots (confirming 0 and non-zero counts display correctly),
pnpm lint,pnpm test:unit, andpnpm test:e2e.PR created automatically by Jules for task 17330098947948746916 started by @bbaaxx