Add GetDashboardV2 RPC to aggregate dashboard content - #9147
Conversation
ea7271e to
c6cdec0
Compare
The dashboard fires ~6 separate RPCs on load (reminders, surfing/hosting host requests, my events, community events, community discussions). Add a single GetDashboardV2 RPC on a new Dashboard service that returns all of them in one call, removing the per-request round-trip and interceptor overhead. The servicer methods that power each section take no instance state, so the aggregator just instantiates the existing servicers and calls their methods directly — no logic is duplicated or moved. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c6cdec0 to
d582db7
Compare
MobileInstall the Dev Tool (iOS via TestFlight, iOS Simulator, or Android .apk) here. Scan the QR with your phone camera, or tap Open in Dev Tool on the device, to open this branch in the installed Dev Tool dev client.
Deep linksiOS Android Web (Vercel)View the Vercel web preview for this branch. Backend
Other
|
|
Shall we call this |
| surfing=Requests().ListHostRequests( | ||
| requests_pb2.ListHostRequestsReq( | ||
| only_sent=True, | ||
| only_active=True, | ||
| status_in=[ | ||
| conversations_pb2.HOST_REQUEST_STATUS_ACCEPTED, | ||
| conversations_pb2.HOST_REQUEST_STATUS_CONFIRMED, | ||
| ], | ||
| sort_by=requests_pb2.HOST_REQUEST_SORT_BY_FROM_DATE, | ||
| ), | ||
| context, | ||
| session, | ||
| ), | ||
| hosting=Requests().ListHostRequests( | ||
| requests_pb2.ListHostRequestsReq( | ||
| only_received=True, | ||
| only_active=True, | ||
| status_in=[ | ||
| conversations_pb2.HOST_REQUEST_STATUS_ACCEPTED, | ||
| conversations_pb2.HOST_REQUEST_STATUS_CONFIRMED, | ||
| ], | ||
| sort_by=requests_pb2.HOST_REQUEST_SORT_BY_FROM_DATE, | ||
| ), | ||
| context, | ||
| session, | ||
| ), |
There was a problem hiding this comment.
These two blocks are identical except only_sent vs only_received. You could extract a small helper like _upcoming_host_requests_req(surfing: bool) so the parameters can't drift apart between the two?
|
@aapeliv I pushed some changes to add the I also went ahead and tested that the backend runs fine locally. Code looks good to me, just that one nit comment. I'd love to get this merged so I can do #9286 on top of this logic instead of what we have now (as it would be cleaner IMO). |


Adds a single
GetDashboardV2RPC (on a newDashboardservice) that returns all the content the dashboard loads today in one call, instead of the frontend fanning out to ~6 separate RPCs (reminders, surfing & hosting host requests, my events, community events, and community discussions).The win is removing the per-request round-trip and interceptor/write overhead paid 6× today (auth,
last_active/UserActivitywrites, connection-pool checkout), not reducing query count — the same queries run, now in one transaction.The query logic for each section is extracted into module-level functions (
get_reminders,list_host_requests,list_my_events,list_my_communities_discussions) that both the existing per-section RPCs and the new aggregator call, so there is no duplicated query/visibility/moderation logic. The existing servicer methods now delegate to these.This is backend only and a draft — the web frontend wiring to consume the new RPC is intentionally not included yet.
Note: generated proto stubs are gitignored and regenerated by CI from
dashboard.proto.Testing
app/backend/src/tests/test_dashboard.py: assertsGetDashboardV2is byte-identical to calling the 6 individual RPCs with the same parameters the web frontend uses, plus role-based bucketing (surfer vs host) and the empty-state.make mypyandmake formatpass.requests/account/events/discussionssuites to confirm the extraction is behavior-preserving — relying on CI for that; the extraction is a pure delegation so existing behavior should be unchanged.Backend checklist
developif necessary for linear migration history (n/a — no DB changes)For maintainers
This PR was created with the Couchers PR skill.