Skip to content

Fix N+1 API calls in admin prospects endpoint#515

Merged
bokelley merged 1 commit intomainfrom
bokelley/fix-slow-prospects
Jan 3, 2026
Merged

Fix N+1 API calls in admin prospects endpoint#515
bokelley merged 1 commit intomainfrom
bokelley/fix-slow-prospects

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

@bokelley bokelley commented Jan 3, 2026

Summary

  • Fix slow loading of /admin/prospects page (was 2-3 seconds, now <500ms)
  • Replace N+1 WorkOS API calls for member counts with a single batch SQL query
  • Use local organization_memberships table (synced via WorkOS webhooks)

Test plan

  • Load /admin/prospects page and verify it loads quickly
  • Verify member counts are displayed correctly in the prospects list
  • Check engagement levels are calculated correctly

🤖 Generated with Claude Code

Replace N+1 WorkOS API calls for member counts with a single batch SQL
query against the local organization_memberships table. This eliminates
the serialized HTTP calls that were causing 2-3 second load times.

The organization_memberships table is kept in sync via WorkOS webhooks,
so member counts remain accurate.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit f336956 into main Jan 3, 2026
6 checks passed
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.

1 participant