Skip to content

Conversation

@keithwillcode
Copy link
Contributor

@keithwillcode keithwillcode commented Jan 27, 2026

What does this PR do?

Removes the _count: { select: { children: true } } pattern from Prisma queries that was generating expensive aggregate queries like:

SELECT ... COALESCE("aggr_selection_0_EventType"."_aggr_count_children", 0) AS "_aggr_count_children" 
FROM "public"."EventType" 
LEFT JOIN (SELECT "public"."EventType"."parentId", COUNT(*) AS "_aggr_count_children" FROM "public"."EventType" WHERE 1=1 GROUP BY "public"."EventType"."parentId") AS "aggr_selection_0_EventType" ...

Changes:

  • Removed _count children select from eventTypeRepository.ts (2 occurrences in workflow-related queries)
  • Removed _count children select from WorkflowRepository.ts (4 occurrences)
  • Updated WorkflowListType type definition to remove the _count property
  • Updated WorkflowListPage.tsx to no longer display the child count (+N) in tooltips

Updates since last revision

  • Added cache bust comment in get.handler.ts to force Turborepo to regenerate TRPC types (workaround for cyclic dependency between @calcom/trpc and @calcom/features preventing proper cache invalidation)

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - no docs changes needed
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Navigate to the Workflows page
  2. Verify workflows still display correctly
  3. Hover over the "Active on X event types" badge to see the tooltip
  4. Confirm event type titles display without the (+N) child count suffix
  5. Verify no console errors or broken functionality

Checklist

  • My code follows the style guidelines of this project
  • I have checked if my changes generate no new warnings
  • My PR is appropriately sized

Link to Devin run: https://app.devin.ai/sessions/6c7de59aad554dd59c7db4d50cf6e53d
Requested by: @keithwillcode

Human Review Notes

  • The import reordering in some files is from Biome auto-formatting, not functional changes
  • The UI will no longer show child event type counts in workflow tooltips - this is intentional per the request
  • The cache bust comment in get.handler.ts is a workaround to force TRPC type regeneration due to Turborepo caching issues (cyclic dependency prevents adding @calcom/features as a proper dependency of @calcom/trpc)

…ories

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@keithwillcode keithwillcode self-assigned this Jan 27, 2026
@keithwillcode keithwillcode added this to the v6.2 milestone Jan 27, 2026
@keithwillcode keithwillcode marked this pull request as ready for review January 27, 2026 17:39
@graphite-app graphite-app bot added the core area: core, team members only label Jan 27, 2026
@graphite-app graphite-app bot requested a review from a team January 27, 2026 17:39
@keithwillcode keithwillcode changed the title fix: remove _count children query from EventType and Workflow repositories perf: remove _count children query from EventType and Workflow repositories Jan 27, 2026
@keithwillcode keithwillcode enabled auto-merge (squash) January 27, 2026 17:42
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 4 files

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

Approved

@keithwillcode keithwillcode merged commit 21500c7 into main Jan 27, 2026
50 checks passed
@keithwillcode keithwillcode deleted the devin/1769534982-remove-children-count-query branch January 27, 2026 18:23
emrysal pushed a commit that referenced this pull request Jan 27, 2026
…ories (#27309)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants