-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Reduce payload even further. #13599
Conversation
This reverts commit c0c4018.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
6 Ignored Deployments
|
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link. |
bd4b9f9
to
ac78096
Compare
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Current Playwright Test Results Summary✅ 447 Passing - Run may still be in progress, this comment will be updated as current testing workflow or job completes... (Last updated on 02/09/2024 12:15:01pm UTC) Run DetailsRunning Workflow PR Update on Github Actions Commit: 8d9df5f Started: 02/09/2024 12:03:08pm UTC
|
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Users can impersonate App Admin can impersonate users with impersonation enabled
Retry 1 • Initial Attempt |
0.29% (1)1 / 339 runfailed over last 7 days |
9.73% (33)33 / 339 runsflaked over last 7 days |
📄 apps/web/playwright/event-types.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Event Types tests -- future user can add multiple organizer address
Retry 1 • Initial Attempt |
0.86% (3)3 / 348 runsfailed over last 7 days |
16.67% (58)58 / 348 runsflaked over last 7 days |
📄 apps/web/playwright/booking/selectQuestion.e2e.ts • 2 Flakes
Top 1 Common Error Messages
|
2 Test Cases Affected |
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Booking With Phone Question and Each Other Question Booking With Select Question and Address Question Select required and Address required
Retry 1 • Initial Attempt |
0% (0)0 / 308 runsfailed over last 7 days |
4.55% (14)14 / 308 runsflaked over last 7 days |
Booking With Phone Question and Each Other Question Booking With Select Question and Radio group Question Select required and Radio group required
Retry 1 • Initial Attempt |
0% (0)0 / 304 runsfailed over last 7 days |
5.59% (17)17 / 304 runsflaked over last 7 days |
📄 apps/web/playwright/booking/checkboxGroupQuestion.e2e.ts • 2 Flakes
Top 1 Common Error Messages
|
2 Test Cases Affected |
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Booking With Checkbox Group Question and Each Other Question Booking With Checkbox Group Question and Address Question Booking With Checkbox Group Question and Radio group Question Checkbox Group and Radio group not required
Retry 1 • Initial Attempt |
0% (0)0 / 319 runsfailed over last 7 days |
4.70% (15)15 / 319 runsflaked over last 7 days |
Booking With Checkbox Group Question and Each Other Question Booking With Checkbox Group Question and Address Question Booking With Checkbox Group Question and select Question Checkbox Group required and select required
Retry 1 • Initial Attempt |
0% (0)0 / 319 runsfailed over last 7 days |
5.64% (18)18 / 319 runsflaked over last 7 days |
📄 apps/web/playwright/booking/responsiveBooking.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Booking page with no questions Booking page with 1920x1080 resolution
Retry 1 • Initial Attempt |
0.32% (1)1 / 309 runfailed over last 7 days |
6.15% (19)19 / 309 runsflaked over last 7 days |
📄 apps/web/playwright/webhook.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Webhook tests FORM_SUBMITTED on submitting user form, triggers user webhook
Retry 1 • Initial Attempt |
0.93% (3)3 / 323 runsfailed over last 7 days |
5.26% (17)17 / 323 runsflaked over last 7 days |
📄 apps/web/playwright/booking/addressQuestione2e/addressQuestion.e2e.ts • 2 Flakes
Top 1 Common Error Messages
|
2 Test Cases Affected |
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Booking With Address Question and Each Other Question Booking With Address Question and Checkbox Question Address required and checkbox required
Retry 2 • Retry 1 • Initial Attempt |
1.77% (6)6 / 339 runsfailed over last 7 days |
5.01% (17)17 / 339 runsflaked over last 7 days |
Booking With Address Question and Each Other Question Booking With Address Question and Short text question Address required and Short text required
Retry 1 • Initial Attempt |
0.61% (2)2 / 328 runsfailed over last 7 days |
4.57% (15)15 / 328 runsflaked over last 7 days |
📄 apps/web/playwright/profile.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Update Profile Cannot update a users email when existing user has same email (verification enabled)
Retry 1 • Initial Attempt |
0% (0)0 / 75 runsfailed over last 7 days |
54.67% (41)41 / 75 runsflaked over last 7 days |
📄 packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 8 Flakes
Top 1 Common Error Messages
|
8 Test Cases Affected |
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Popup Tests should open embed iframe on click - Configured with light theme
Retry 1 • Initial Attempt |
-0.30% (-1)-1 / 332 runsfailed over last 7 days |
52.71% (175)175 / 332 runsflaked over last 7 days |
Popup Tests should be able to reschedule
Retry 1 • Initial Attempt |
-111.46% (-175)-175 / 157 runsfailed over last 7 days |
111.46% (175)175 / 157 runsflaked over last 7 days |
Popup Tests should open Routing Forms embed on click
Retry 1 • Initial Attempt |
-106.37% (-167)-167 / 157 runsfailed over last 7 days |
107.01% (168)168 / 157 runsflaked over last 7 days |
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when no theme is configured through Embed API
Retry 1 • Initial Attempt |
-107.69% (-168)-168 / 156 runsfailed over last 7 days |
107.69% (168)168 / 156 runsflaked over last 7 days |
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when configured with 'auto' theme using Embed API
Retry 1 • Initial Attempt |
-107.69% (-168)-168 / 156 runsfailed over last 7 days |
107.69% (168)168 / 156 runsflaked over last 7 days |
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe(Booker Profile Page) with dark theme when configured with dark theme using Embed API
Retry 1 • Initial Attempt |
-107.05% (-167)-167 / 156 runsfailed over last 7 days |
107.05% (167)167 / 156 runsflaked over last 7 days |
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe(Event Booking Page) with dark theme when configured with dark theme using Embed API
Retry 1 • Initial Attempt |
-107.05% (-167)-167 / 156 runsfailed over last 7 days |
107.05% (167)167 / 156 runsflaked over last 7 days |
Popup Tests prendered embed should be loaded and apply the config given to it
Retry 1 • Initial Attempt |
-107.05% (-167)-167 / 156 runsfailed over last 7 days |
107.05% (167)167 / 156 runsflaked over last 7 days |
📄 packages/app-store/routing-forms/playwright/tests/basic.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Routing Forms Seeded Routing Form Router URL should work
Retry 1 • Initial Attempt |
0.89% (3)3 / 338 runsfailed over last 7 days |
14.79% (50)50 / 338 runsflaked over last 7 days |
ac78096
to
8cfef23
Compare
8cfef23
to
459b998
Compare
@@ -1,16 +1,20 @@ | |||
import { Prisma } from "@prisma/client"; | |||
// eslint-disable-next-line no-restricted-imports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is the same as it was earlier before we reverted profile querying except for doing the normalization before sending the payload.
return normalizePayload(denormalizedPayload); | ||
|
||
/** | ||
* Reduces the size of payload | ||
*/ | ||
function normalizePayload(payload: typeof denormalizedPayload) { | ||
const allUsersAcrossAllEventTypes = new Map< | ||
number, | ||
EventTypeGroup["eventTypes"][number]["users"][number] | ||
>(); | ||
const eventTypeGroups = payload.eventTypeGroups.map((group) => { | ||
return { | ||
...group, | ||
eventTypes: group.eventTypes.map((eventType) => { | ||
const { users, ...rest } = eventType; | ||
return { | ||
...rest, | ||
// Send userIds per event and keep the actual users object outside | ||
userIds: users.map((user) => { | ||
allUsersAcrossAllEventTypes.set(user.id, user); | ||
return user.id; | ||
}), | ||
}; | ||
}), | ||
}; | ||
}); | ||
|
||
return { | ||
...payload, | ||
allUsersAcrossAllEventTypes, | ||
eventTypeGroups, | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the normalization change
(filters?.teamIds?.length === 1 || filters?.userIds?.length === 1) && | ||
rawData.eventTypeGroups.length === 1; | ||
|
||
const data = denormalizePayload(rawData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the sent payload is in a different format now, we need to denormalize it before others can keep consuming it without any change.
return ( | ||
<> | ||
{data.eventTypeGroups.length > 1 || isFilteredByOnlyOneItem ? ( | ||
<> | ||
{isMobile ? ( | ||
<MobileTeamsTab eventTypeGroups={data.eventTypeGroups} /> | ||
) : ( | ||
data.eventTypeGroups.map((group: EventTypeGroup, index: number) => ( | ||
data.eventTypeGroups.map((group, index: number) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't needed.
@@ -238,7 +260,7 @@ export const EventTypeList = ({ | |||
await utils.viewer.eventTypes.getByViewer.cancel(); | |||
const previousValue = utils.viewer.eventTypes.getByViewer.getData(); | |||
if (previousValue) { | |||
const newList = [...types]; | |||
const newList = [...types.map(normalizeEventType)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimistic updates need to do in memory conversion to make the format consistent with react query response for getByViewer
@@ -175,6 +166,7 @@ export class EventTypeRepository { | |||
return await prisma.eventType.findMany({ | |||
where: { | |||
profileId, | |||
...where, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing where clause.
Reverts #13588 and then improves upon the following to further decrease the payload size
NOTE: Because the first commit is just a revert commit of #13588. Use this link to review the changes https://github.com/calcom/cal.com/pull/13599/files/309e073303c60e3cbaff7a24401883131b62d538..8d9df5ff92e007b11ffa7dde75185dc9dd6e77d9#diff-5294731b960e76c72f504ce7e1381d51e5c054131976fe7f43bb38f485d76aa6 (it excludes that revert commit)
Profile Based Querying - Before
![image](https://private-user-images.githubusercontent.com/1780212/303601933-a731b420-10ad-46a1-b4fd-4a8ecfcfb992.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1OTIwMzgsIm5iZiI6MTcyMTU5MTczOCwicGF0aCI6Ii8xNzgwMjEyLzMwMzYwMTkzMy1hNzMxYjQyMC0xMGFkLTQ2YTEtYjRmZC00YThlY2ZjZmI5OTIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjFUMTk1NTM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWUwZTY3ODlmN2U2MDFmM2IzYmM5ZmM5ZDgwMmQzYWJlYjNlZDZiYzJiNDc5MjdmYjZhOWJjNjQ0NzczZGIzZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.vxu6tYvBNbNRjcBZLP0CX8MRf_Sl1ri3dWdnjPU1Kvs)
Profile Based Querying - After - THIS BRANCH -> Though the time taken to serve it is significantly more than non-profile based querying, the payload is smaller. I am hoping this won't be a big issue in production. We can work on improving that later. I expect mostly increase is due to every user needing a join with profile now.
![image](https://private-user-images.githubusercontent.com/1780212/303602222-e9b5a21d-69ba-48d0-a468-3bfa41750565.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1OTIwMzgsIm5iZiI6MTcyMTU5MTczOCwicGF0aCI6Ii8xNzgwMjEyLzMwMzYwMjIyMi1lOWI1YTIxZC02OWJhLTQ4ZDAtYTQ2OC0zYmZhNDE3NTA1NjUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjFUMTk1NTM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NzEyOTdmNmNiYjM2MDk2MDNlYzQ3ZjVkY2JkZWZlZDlkMmU1M2Y5NjEwNDA2NDY1MmFmMGJkMjMyOWU4YmRhZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.IiITj3oDlsAPKGYBVLotanDjUwZ13i85Ki7uQcyb6qY)
Non Profile Based Querying
![image](https://private-user-images.githubusercontent.com/1780212/303602843-46bd7524-b79a-4154-bac8-3e7bced7599c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1OTIwMzgsIm5iZiI6MTcyMTU5MTczOCwicGF0aCI6Ii8xNzgwMjEyLzMwMzYwMjg0My00NmJkNzUyNC1iNzlhLTQxNTQtYmFjOC0zZTdiY2VkNzU5OWMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjFUMTk1NTM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9M2Q5MDcwM2U5MmFmOWI4MzQ2NmMzMTk0YjI5YmNhZmI0NmI4NWJkNDM2ZGEzZmYzYTZiNDVmY2QwMWM3NmZmMiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.cXQHJ_kQPKKKXTk4FmNHLBkOWHOrk_OhAqxDH5P_IzI)