Skip to content

fix: batch room meeting status queries via prop-drilling#850

Draft
deardarlingoose wants to merge 2 commits intomainfrom
fix-room-query-prop-drilling
Draft

fix: batch room meeting status queries via prop-drilling#850
deardarlingoose wants to merge 2 commits intomainfrom
fix-room-query-prop-drilling

Conversation

@deardarlingoose
Copy link
Contributor

Summary

Alternative to #848 (batcher approach): prop-drilling version that achieves the same N+1 → 1 query reduction without @yornaath/batshit dependency.

  • Backend: Same POST /v1/rooms/meetings/bulk-status endpoint + bulk DB methods (get_by_names, get_all_active_for_rooms, get_upcoming_for_rooms)
  • Frontend: Parent (RoomList) fetches all room statuses via useRoomsBulkMeetingStatus(roomNames) hook, passes data down as props to RoomTableMeetingStatus
  • CI: Fix pnpm 8→10 auto-detect, add concurrency group, dedupe setup-node
  • Tests: Jest + jsdom + testing-library, 3 tests for bulk hook

Prop-drilling vs Batcher trade-offs

Aspect #848 (Batcher) This PR (Prop-drilling)
Data ownership Per-component (each MeetingStatus owns its query) Parent (RoomList owns all meeting data)
Batching @yornaath/batshit DataLoader with 10ms window None needed — single useQuery call
New dependency @yornaath/batshit None
Extra module meetingStatusBatcher.ts None
Query key Per-room keys via $api.queryOptions Single ["bulk-meeting-status", roomNames]
Cache granularity Per-room invalidation Coarser (entire list)
Reuse in other contexts Each card self-contained Parent must re-implement bulk fetch

Test plan

  • CI workflow runs (triggers on www/** changes)
  • Rooms page loads with single bulk POST (verify in network tab)
  • Individual room pages still work (MeetingSelection.tsx unchanged, uses per-room hook)
  • Meeting create/deactivate invalidates bulk status cache

Alternative to the batcher approach (#848): parent fetches all room
meeting statuses in a single bulk POST and passes data down as props.
No extra dependency (@yornaath/batshit), no implicit batching magic.

Backend: POST /v1/rooms/meetings/bulk-status + bulk DB methods.
Frontend: useRoomsBulkMeetingStatus hook in RoomList, MeetingStatus
receives data as props instead of calling per-room hooks.
CI: fix pnpm 8→10 auto-detect, add concurrency group.
Tests: Jest+jsdom+testing-library for bulk hook.
@deardarlingoose deardarlingoose mentioned this pull request Feb 6, 2026
3 tasks
- Add PUBLIC_MODE auth guard on bulk-status endpoint
- Convert DB models to view models via model_validate()
- Early return when no accessible rooms (skip DB queries)
- BulkMeetingStatusMap: Partial<Record> for type honesty
- Sort roomNames in query key for cache stability
- Remove redundant empty-guard in queryFn
- Add 7 backend tests: auth, redaction, whereby host_room_url, 401, empty
- Add 2 frontend tests: error handling, unauthenticated case
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