feat: split eventTypes router into individual sub-routers per handler#23545
Closed
keithwillcode wants to merge 7 commits intomainfrom
Closed
feat: split eventTypes router into individual sub-routers per handler#23545keithwillcode wants to merge 7 commits intomainfrom
keithwillcode wants to merge 7 commits intomainfrom
Conversation
- Break out monolithic eventTypes router into 15 separate sub-routers - Create individual API endpoints for each handler under /eventTypes/[handler]/ - Update all client-side references to use new sub-router structure - Use .do() for mutations and .get() for queries as requested - Update router registration in viewer router to use individual routers - Fix localStorage import and unused variable lint issues - Maintain backward compatibility during transition - Improves bundle splitting and reduces initial load times Sub-routers created: - getByViewer, getUserEventGroups, getEventTypesFromGroup - getTeamAndEventTypeOptions, list, listWithTeam - create, get, update, delete, duplicate - bulkEventFetch, bulkUpdateToDefaultLocation - getHashedLink, getHashedLinks This prevents unused handlers like duplicate.handler.ts from being imported when loading pages that don't need them, achieving the bundle splitting optimization goal. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
- Add individual eventTypes sub-router endpoints to ENDPOINTS array - Update resolveEndpoint function to handle 4-segment paths like viewer.eventTypes.duplicate.do - Route eventTypes sub-router calls to correct API endpoints (e.g., eventTypes/duplicate) Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
- Update remaining variable references to use underscore-prefixed names - Fix metadata, seatsPerTimeSlot, recurringEvent, bookingLimits, and durationLimits references - All TypeScript errors now resolved Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
- Modify resolveEndpoint function to generate URLs like /api/trpc/eventTypes/duplicate/get - Update ENDPOINTS array to include full paths with method names - Fixes URL generation bug where dots were used instead of slashes Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
…:calcom/cal.com into devin/split-eventtypes-router-1756907432
Contributor
Author
|
This reduces compilation time for |
Closed
Contributor
Author
|
Closing since this was just a test. We don't actually want to go this route. Exploring #23555 instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR breaks out the monolithic
eventTypestRPC router into 15 individual sub-routers to enable better bundle splitting and reduce initial load times.Problem: The monolithic router was causing unnecessary imports - for example, just loading the
/event-typespage would importduplicate.handler.ts, which then imports the entire calendar service chain, even though duplicate functionality isn't needed for viewing event types.Solution: Split each handler into its own router with its own API endpoint, allowing webpack to bundle split more effectively.
Key Changes
packages/trpc/server/routers/viewer/eventTypes/[handler]/apps/web/pages/api/trpc/eventTypes/[handler]/[trpc].tstrpc.viewer.eventTypes.{handler}.{action}()where:.do()for mutations (create, update, delete, duplicate, etc.).get()for queries (getByViewer, list, etc.)Sub-routers Created
Queries (
.get()):getByViewer,getUserEventGroups,getEventTypesFromGroupgetTeamAndEventTypeOptions,list,listWithTeamget,bulkEventFetch,getHashedLink,getHashedLinksMutations (
.do()):create,update,delete,duplicatebulkUpdateToDefaultLocationExample Usage Changes
Before:
After:
How should this be tested?
Critical Testing Areas:
/event-typesno longer importsduplicate.handler.tsin dev toolsyarn type-check:ci --forceto catch any type mismatchesTest Environment:
Mandatory Tasks
Human Review Checklist
High Priority:
Medium Priority:
Link to Devin run: https://app.devin.ai/sessions/18e008a7abaf483393a74d9fa655cad3
Requested by: @keithwillcode