⚡ Bolt: [performance improvement] Concurrent data fetching in classroom APIs#143
⚡ Bolt: [performance improvement] Concurrent data fetching in classroom APIs#143xb1g wants to merge 1 commit into
Conversation
Co-authored-by: xb1g <70068561+xb1g@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. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3f92abb to
345e993
Compare
|
Unable to deploy a commit from a private repository on your GitHub organization to the wachaa1319's projects team on Vercel, which is currently on the Hobby plan. In order to deploy, you can:
To read more about collaboration on Vercel, click here. |
There was a problem hiding this comment.
Pull request overview
Refactors classroom-related Next.js API route handlers to fetch independent Supabase queries concurrently, reducing request latency for the classroom list and classroom stats dashboard endpoints.
Changes:
/api/classrooms: fetch classroom details and membership rows in parallel and compute per-classroom member/role counts from the combined results./api/classrooms/[id]/stats: fetch membership roles, active assignment count, and enrollment progress concurrently to avoid sequential (“waterfall”) DB waits.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| app/api/classrooms/route.ts | Uses Promise.all to fetch classroom records and membership rows concurrently, then derives member/role counts for response shaping. |
| app/api/classrooms/[id]/stats/route.ts | Uses Promise.all to fetch membership role data, active assignment count, and enrollment progress concurrently before computing stats. |
345e993 to
de3aa88
Compare
de3aa88 to
2d5ec3c
Compare
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
web | 2d5ec3c | May 11 2026, 06:39 PM |
💡 What: Refactored multiple sequential Supabase database queries into concurrent queries using
Promise.allin two API endpoints:app/api/classrooms/route.tsandapp/api/classrooms/[id]/stats/route.ts.🎯 Why: To eliminate "waterfall" network requests. In Node.js serverless environments, waiting for independent queries sequentially artificially increases latency. By firing them concurrently, we reduce the total response time to the duration of the slowest single query.
📊 Impact: Expect a noticeable reduction in latency when fetching the user's classroom list and classroom statistics dashboard. The total database wait time in these handlers is roughly cut in half (or a third).
🔬 Measurement: Verify the improvement by timing the GET requests to
/api/classroomsand/api/classrooms/[id]/statsbefore and after this change under typical network conditions. Ensure the test suite continues to pass and no data is missing.PR created automatically by Jules for task 9959380812066159046 started by @xb1g