feat: optimize the about page queries#3626
Conversation
WalkthroughAdds a backend GraphQL field to fetch multiple users by login, consolidates multiple frontend About-page GraphQL requests into a single query and updates the About page and tests to use the unified response, and renames local docker-compose volumes by appending Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~28 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/__tests__/e2e/pages/About.spec.ts (1)
7-22: Add a fallback for unexpected operations to avoid hanging tests.Right now non-matching GraphQL operations never resolve, which can stall the test suite. Fail fast or pass through explicitly.
🛠️ Proposed fix (fail fast)
- if (postData.operationName === 'GetAboutPageData') { + if (postData.operationName === 'GetAboutPageData') { await route.fulfill({ status: 200, json: { data: { project: mockAboutData.project, topContributors: mockAboutData.topContributors, users: mockAboutData.users, }, }, }) + return } + await route.fulfill({ + status: 400, + json: { errors: [{ message: `Unexpected operation: ${postData.operationName}` }] }, + })
🤖 Fix all issues with AI agents
In `@backend/apps/github/api/internal/queries/user.py`:
- Around line 56-67: The users resolver currently returns a list and uses
login__in which loses input order and prevents Strawberry/Django optimizer
hooks; change the users method to return a QuerySet (not list) from
User.objects.filter(login__in=logins, has_public_member_page=True) and apply an
explicit ordering that preserves the order of the incoming logins using Django's
Case/When (build When conditions for each login and order_by the Case
expression) so results match the input sequence while keeping a QuerySet for
optimizer integration.
In `@frontend/__tests__/unit/pages/About.test.tsx`:
- Around line 417-421: The test "handles null project in data response
gracefully" is mocking useQuery incorrectly by returning project at the top
level; update the mock for useQuery (used in this test) to return an object
shaped like the real hook: { data: { ...mockAboutData, project: null }, loading:
false, error: null } so the component receives data.project === null and follows
the intended code path; keep the mockAboutData reference and the test name to
locate the test and adjust only the mockReturnValue shape.
In `@frontend/src/app/about/page.tsx`:
- Around line 77-83: The variable leadersData can be undefined when
aboutPageDataResponse?.users is missing, causing downstream components to break;
update the leadersData assignment (the leadersData constant that builds from
aboutPageDataResponse?.users) to default to an empty array and only map when
users exist — e.g., treat aboutPageDataResponse?.users || [] (or use a
conditional fallback) so leadersData always yields an array of objects using
leaders[leader.login], memberName and member.
|
| name | ||
| } | ||
|
|
||
| users(logins: $leaderLogins) { |
There was a problem hiding this comment.
This is a better approach long term 👍
|
Closing in favor of #3604 |



Proposed change
Resolves #3592
This PR optimises the about page queries by combining them into a single query. Unit and e2e tests are also modified to handle these changes. Some changes related to a separate new query field,
users, have been added to handle leaders' data and follow the DRY principle.Checklist
make check-testlocally: all warnings addressed, tests passed