Skip to content

fix(aurora): avoid fetching all projects on project detail page#1061

Open
taymoor89 wants to merge 2 commits into
mainfrom
fix-app-slowdown
Open

fix(aurora): avoid fetching all projects on project detail page#1061
taymoor89 wants to merge 2 commits into
mainfrom
fix-app-slowdown

Conversation

@taymoor89

@taymoor89 taymoor89 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

On the project detail page (/projects/:id), the loader was fetching all projects via getAuthProjects just 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 single getProject call to GET /v3/projects/:id.

Additionally, the projects home page had no pendingComponent, causing a blank screen during slow getAuthProjects responses.

Changes Made

  • Add getProject tRPC procedure fetching a single project by ID from Keystone (GET /v3/projects/:id)
  • Replace getAuthProjects with getProject in the $projectId loader to avoid fetching the full project list on every project detail page
  • Update resolveProjectScope to accept userProject (single record) instead of userProjects (full list)
  • Add pendingComponent to /projects route to show spinner during slow getAuthProjects loads

Related Issues

  • Issue 1: [link to issue]

Screenshots (if applicable)

N/A

Testing Instructions

  1. pnpm i
  2. pnpm run test
  3. Navigate to /projects/:id directly - verify getAuthProjects is no longer called in the network tab
  4. Navigate to /projects on a slow connection - verify spinner appears immediately instead of a blank screen

Checklist

  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have made corresponding changes to the documentation (if applicable).
  • My changes generate no new warnings or errors.

@taymoor89 taymoor89 requested a review from a team as a code owner July 13, 2026 14:40
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@taymoor89, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cac349ea-67c4-43bc-a3fb-8d6bd6f13cf9

📥 Commits

Reviewing files that changed from the base of the PR and between 0379a35 and 7bd9334.

📒 Files selected for processing (7)
  • .changeset/fix-project-detail-slowdown.md
  • packages/aurora/src/client/routes/_auth/projects/$projectId.tsx
  • packages/aurora/src/client/routes/_auth/projects/-components/resolveProjectScope.test.ts
  • packages/aurora/src/client/routes/_auth/projects/-components/resolveProjectScope.ts
  • packages/aurora/src/client/routes/_auth/projects/index.tsx
  • packages/aurora/src/server/Project/routers/projectRouter.test.ts
  • packages/aurora/src/server/Project/routers/projectRouter.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-app-slowdown

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.getProject tRPC query to fetch one project by ID from Keystone (GET /v3/projects/:id).
  • Updated the /projects/$projectId loader and resolveProjectScope to use the single-project fetch instead of loading all projects.
  • Added a pendingComponent spinner overlay to the /projects route 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.

Comment thread packages/aurora/src/server/Project/routers/projectRouter.ts
Comment thread packages/aurora/src/client/routes/_auth/projects/$projectId.tsx
Comment thread packages/aurora/src/server/Project/routers/projectRouter.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants