fix(aurora): avoid fetching all projects on project detail page#1061
fix(aurora): avoid fetching all projects on project detail page#1061taymoor89 wants to merge 2 commits into
Conversation
|
Warning Review limit reached
Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ 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 |
There was a problem hiding this comment.
Pull request overview
This PR improves perceived and actual performance on the project detail route by avoiding a full /v3/auth/projects fetch in the /projects/:id loader and instead fetching a single project record, plus it adds a loading UI for slow project-list loads.
Changes:
- Added a new
project.getProjecttRPC query to fetch one project by ID from Keystone (GET /v3/projects/:id). - Updated the
/projects/$projectIdloader andresolveProjectScopeto use the single-project fetch instead of loading all projects. - Added a
pendingComponentspinner overlay to the/projectsroute to avoid a blank screen during slow loads.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/aurora/src/server/Project/routers/projectRouter.ts | Adds getProject procedure for single-project fetch. |
| packages/aurora/src/server/Project/routers/projectRouter.test.ts | Adds tests for the new getProject procedure. |
| packages/aurora/src/client/routes/_auth/projects/index.tsx | Adds pending spinner UI for slow project list loading. |
| packages/aurora/src/client/routes/_auth/projects/$projectId.tsx | Switches loader from getAuthProjects to getProject and uses new scope-resolution input. |
| packages/aurora/src/client/routes/_auth/projects/-components/resolveProjectScope.ts | Updates scope resolution to accept a single fetched project. |
| packages/aurora/src/client/routes/_auth/projects/-components/resolveProjectScope.test.ts | Updates tests for new scope-resolution behavior. |
| .changeset/fix-project-detail-slowdown.md | Adds changeset entry for the patch release. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
On the project detail page (
/projects/:id), the loader was fetching all projects viagetAuthProjectsjust to validate scope and retrieve the project description. On production with large project counts, this made every project page slow - switching between projects felt noticeably laggy. This PR replaces that full-list fetch with a singlegetProjectcall toGET /v3/projects/:id.Additionally, the projects home page had no
pendingComponent, causing a blank screen during slowgetAuthProjectsresponses.Changes Made
getProjecttRPC procedure fetching a single project by ID from Keystone (GET /v3/projects/:id)getAuthProjectswithgetProjectin the$projectIdloader to avoid fetching the full project list on every project detail pageresolveProjectScopeto acceptuserProject(single record) instead ofuserProjects(full list)pendingComponentto/projectsroute to show spinner during slowgetAuthProjectsloadsRelated Issues
Screenshots (if applicable)
N/A
Testing Instructions
pnpm ipnpm run test/projects/:iddirectly - verifygetAuthProjectsis no longer called in the network tab/projectson a slow connection - verify spinner appears immediately instead of a blank screenChecklist