Skip to content
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: Broken SSR for event booking pages #14497

Merged
merged 4 commits into from Apr 11, 2024

Conversation

hariombalhara
Copy link
Member

@hariombalhara hariombalhara commented Apr 10, 2024

What does this PR do?

Fixes broken OG images.

Happened because React Query is unable to reuse already sent /event request's response and because SSR doesn’t wait for re-renders, it gets event as undefined causing the issue of OG image generation(which is completely SSR)

It happened because of newly introduced param orgRedirection which is by default assumed false but for React Query orgRedirection=undefined and orgRedirection=false are two different queries.

Wrote a failing test now that’s passing in the PR

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

  • Simply see the source code for pro/30min and notice that title is wrong in it.
  • It has og:image URL also wrong

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @hariombalhara and the rest of your teammates on Graphite Graphite

Copy link

vercel bot commented Apr 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview Apr 11, 2024 4:27am
cal ⬜️ Ignored (Inspect) Visit Preview Apr 11, 2024 4:27am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Apr 11, 2024 4:27am
qa ⬜️ Ignored (Inspect) Visit Preview Apr 11, 2024 4:27am

Copy link
Contributor

github-actions bot commented Apr 10, 2024

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

Copy link
Contributor

github-actions bot commented Apr 10, 2024

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Seventy-five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/[user]/[type] 409.89 KB 638.13 KB 182.32% (🟢 -0.33%)
/[user]/[type]/embed 409.9 KB 638.13 KB 182.32% (🟢 -0.33%)
/apps/categories 255.17 KB 483.4 KB 138.12% (🟡 +0.39%)
/auth/forgot-password/[id] 106.36 KB 334.6 KB 95.60% (🟡 +0.21%)
/availability 462.19 KB 690.42 KB 197.26% (🟡 +0.15%)
/availability/[schedule] 409.03 KB 637.26 KB 182.07% (🟡 +0.36%)
/availability/troubleshoot 201.1 KB 429.33 KB 122.67% (🟢 -0.25%)
/bookings/[status] 322.92 KB 551.15 KB 157.47% (🟡 +0.39%)
/d/[link]/[slug] 409.7 KB 637.94 KB 182.27% (🟢 -0.34%)
/enterprise 255.23 KB 483.46 KB 138.13% (🟡 +0.39%)
/getting-started/[[...step]] 404.26 KB 632.49 KB 180.71% (🟢 -0.34%)
/insights 473.64 KB 701.87 KB 200.53% (🟡 +0.40%)
/more 254.73 KB 482.97 KB 137.99% (🟡 +0.39%)
/org/[orgSlug]/[user]/[type] 410.1 KB 638.33 KB 182.38% (🟢 -0.33%)
/org/[orgSlug]/[user]/[type]/embed 410.13 KB 638.36 KB 182.39% (🟢 -0.34%)
/org/[orgSlug]/instant-meeting/team/[slug]/[type] 409.72 KB 637.96 KB 182.27% (🟢 -0.33%)
/org/[orgSlug]/team/[slug]/[type] 409.92 KB 638.15 KB 182.33% (🟢 -0.34%)
/settings/admin 261.02 KB 489.26 KB 139.79% (🟡 +0.38%)
/settings/admin/apps 274.09 KB 502.32 KB 143.52% (🟡 +0.39%)
/settings/admin/apps/[category] 274.08 KB 502.31 KB 143.52% (🟡 +0.38%)
/settings/admin/flags 264.82 KB 493.06 KB 140.87% (🟡 +0.39%)
/settings/admin/impersonation 261.32 KB 489.56 KB 139.87% (🟡 +0.39%)
/settings/admin/oAuth 273.03 KB 501.26 KB 143.22% (🟡 +0.38%)
/settings/admin/orgMigrations/_OrgMigrationLayout 249.61 KB 477.85 KB 136.53% (🟡 +0.38%)
/settings/admin/orgMigrations/moveTeamToOrg 299.1 KB 527.33 KB 150.67% (🟡 +0.38%)
/settings/admin/orgMigrations/moveUserToOrg 318.17 KB 546.41 KB 156.12% (🟡 +0.37%)
/settings/admin/orgMigrations/removeTeamFromOrg 298.86 KB 527.09 KB 150.60% (🟡 +0.38%)
/settings/admin/orgMigrations/removeUserFromOrg 298.87 KB 527.1 KB 150.60% (🟡 +0.39%)
/settings/admin/organizations 262.9 KB 491.14 KB 140.32% (🟡 +0.39%)
/settings/admin/organizations/[id]/edit 261.57 KB 489.81 KB 139.94% (🟡 +0.39%)
/settings/admin/users 263.67 KB 491.9 KB 140.54% (🟡 +0.39%)
/settings/admin/users/[id]/edit 391.92 KB 620.15 KB 177.19% (🟡 +0.38%)
/settings/admin/users/add 391.59 KB 619.82 KB 177.09% (🟡 +0.39%)
/settings/billing 261.22 KB 489.46 KB 139.85% (🟡 +0.38%)
/settings/developer/api-keys 265.6 KB 493.83 KB 141.09% (🟡 +0.39%)
/settings/developer/webhooks 265.73 KB 493.96 KB 141.13% (🟡 +0.39%)
/settings/developer/webhooks/[id] 266.66 KB 494.9 KB 141.40% (🟡 +0.24%)
/settings/developer/webhooks/new 266.71 KB 494.94 KB 141.41% (🟡 +0.24%)
/settings/my-account/appearance 313.6 KB 541.83 KB 154.81% (🟡 +0.39%)
/settings/my-account/conferencing 273.08 KB 501.32 KB 143.23% (🟡 +0.22%)
/settings/my-account/general 349.14 KB 577.38 KB 164.96% (🟡 +0.39%)
/settings/my-account/profile 404.23 KB 632.46 KB 180.70% (🟡 +0.34%)
/settings/organizations/[id]/onboard-members 171.45 KB 399.68 KB 114.19% (🟡 +0.16%)
/settings/organizations/appearance 284.75 KB 512.98 KB 146.57% (🟡 +0.38%)
/settings/organizations/billing 261.26 KB 489.5 KB 139.86% (🟡 +0.38%)
/settings/organizations/dsync 330.94 KB 559.17 KB 159.76% (🟡 +0.26%)
/settings/organizations/general 349.13 KB 577.36 KB 164.96% (🟡 +0.39%)
/settings/organizations/members 429.2 KB 657.43 KB 187.84% (🟡 +0.19%)
/settings/organizations/platform/oauth-clients 262.91 KB 491.14 KB 140.33% (🟡 +0.38%)
/settings/organizations/platform/oauth-clients/create 262.42 KB 490.66 KB 140.19% (🟡 +0.38%)
/settings/organizations/privacy 266.61 KB 494.84 KB 141.38% (🟡 +0.39%)
/settings/organizations/profile 395.9 KB 624.14 KB 178.32% (🟡 +0.39%)
/settings/organizations/sso 271.88 KB 500.11 KB 142.89% (🟡 +0.38%)
/settings/organizations/teams/other 262.09 KB 490.32 KB 140.09% (🟡 +0.39%)
/settings/organizations/teams/other/[id]/appearance 273.76 KB 501.99 KB 143.43% (🟡 +0.38%)
/settings/organizations/teams/other/[id]/members 268.56 KB 496.79 KB 141.94% (🟡 +0.39%)
/settings/organizations/teams/other/[id]/profile 467.18 KB 695.41 KB 198.69% (🟡 +0.29%)
/settings/security/impersonation 266.41 KB 494.64 KB 141.33% (🟡 +0.38%)
/settings/security/password 303.87 KB 532.11 KB 152.03% (🟡 +0.36%)
/settings/security/sso 271.28 KB 499.51 KB 142.72% (🟡 +0.38%)
/settings/security/two-factor-auth 269.86 KB 498.09 KB 142.31% (🟡 +0.38%)
/settings/teams 260.76 KB 489 KB 139.71% (🟡 +0.39%)
/settings/teams/[id]/appearance 273.74 KB 501.98 KB 143.42% (🟡 +0.39%)
/settings/teams/[id]/billing 261.26 KB 489.5 KB 139.86% (🟡 +0.38%)
/settings/teams/[id]/members 380.41 KB 608.64 KB 173.90% (🟡 +0.35%)
/settings/teams/[id]/onboard-members 170.62 KB 398.86 KB 113.96% (🟡 +0.15%)
/settings/teams/[id]/profile 468.02 KB 696.25 KB 198.93% (🟡 +0.29%)
/settings/teams/new 198.05 KB 426.29 KB 121.80% (🟡 +0.23%)
/signup 178.56 KB 406.79 KB 116.23% (🟡 +0.24%)
/team/[slug]/[type] 409.88 KB 638.12 KB 182.32% (🟢 -0.34%)
/team/[slug]/[type]/embed 409.91 KB 638.15 KB 182.33% (🟢 -0.34%)
/teams 254.96 KB 483.19 KB 138.05% (🟡 +0.40%)
/upgrade 255.08 KB 483.31 KB 138.09% (🟡 +0.39%)
/workflows 286.18 KB 514.42 KB 146.98% (🟡 +0.37%)
/workflows/[workflow] 408.36 KB 636.6 KB 181.89% (🟡 +0.37%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

Copy link

deploysentinel bot commented Apr 10, 2024

Current Playwright Test Results Summary

✅ 302 Passing - ⚠️ 14 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 04/11/2024 04:41:30am UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: a54e31e

Started: 04/11/2024 04:38:31am UTC

⚠️ Flakes

📄   apps/web/playwright/login.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
user can login & logout succesfully -- future login flow user & logout using dashboard
Retry 1Initial Attempt
5.54% (16) 16 / 289 runs
failed over last 7 days
23.88% (69) 69 / 289 runs
flaked over last 7 days
Login and logout tests -- legacy Login flow validations -- future Should warn when user does not exist
Retry 1Initial Attempt
0% (0) 0 / 289 runs
failed over last 7 days
2.77% (8) 8 / 289 runs
flaked 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 Test preview should return correct route
Retry 1Initial Attempt
0% (0) 0 / 296 runs
failed over last 7 days
34.12% (101) 101 / 296 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 8 Flakes

Top 1 Common Error Messages

null

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 1Initial Attempt
0.34% (1) 1 / 296 run
failed over last 7 days
62.50% (185) 185 / 296 runs
flaked over last 7 days
Popup Tests should be able to reschedule
Retry 1Initial Attempt
-167.27% (-184) -184 / 110 runs
failed over last 7 days
167.27% (184) 184 / 110 runs
flaked over last 7 days
Popup Tests should open Routing Forms embed on click
Retry 1Initial Attempt
-167.27% (-184) -184 / 110 runs
failed over last 7 days
167.27% (184) 184 / 110 runs
flaked 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 1Initial Attempt
-166.36% (-183) -183 / 110 runs
failed over last 7 days
167.27% (184) 184 / 110 runs
flaked 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 1Initial Attempt
-168.81% (-184) -184 / 109 runs
failed over last 7 days
168.81% (184) 184 / 109 runs
flaked 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 1Initial Attempt
-168.81% (-184) -184 / 109 runs
failed over last 7 days
168.81% (184) 184 / 109 runs
flaked 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 1Initial Attempt
-168.81% (-184) -184 / 109 runs
failed over last 7 days
168.81% (184) 184 / 109 runs
flaked over last 7 days
Popup Tests prendered embed should be loaded and apply the config given to it
Retry 1Initial Attempt
-168.81% (-184) -184 / 109 runs
failed over last 7 days
168.81% (184) 184 / 109 runs
flaked over last 7 days

📄   apps/web/playwright/integrations-stripe.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Stripe integration Pending payment booking should not be confirmed by default
Retry 2Retry 1Initial Attempt
1.37% (4) 4 / 292 runs
failed over last 7 days
26.03% (76) 76 / 292 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/preview.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Preview Preview - embed-core should load
Retry 1Initial Attempt
0% (0) 0 / 297 runs
failed over last 7 days
35.35% (105) 105 / 297 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/inline.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Inline Iframe Inline Iframe - Configured with Dark Theme
Retry 1Initial Attempt
0.67% (2) 2 / 297 runs
failed over last 7 days
53.20% (158) 158 / 297 runs
flaked over last 7 days

View Detailed Build Results


@hariombalhara hariombalhara changed the title fix: Broken SSR for event type pages fix: Broken SSR for event booking pages Apr 10, 2024
// Trigger the page navigation
page.goto(`/${user.username}/30-min`),
]);
const ssrResponse = await response.text();
Copy link
Member Author

Choose a reason for hiding this comment

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

Important to verify on raw text as on client it gets fixed as soon as react hydration kicks in.

@@ -291,6 +292,7 @@ export const getPublicEvent = async (
profile: getProfileFromEvent(eventWithUserProfiles),
users,
entity: {
fromRedirectOfNonOrgLink,
Copy link
Member Author

Choose a reason for hiding this comment

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

Send it back so that react query can sent it again and cached response can be served by react query.

zomars
zomars previously approved these changes Apr 10, 2024
Copy link
Member

@zomars zomars left a comment

Choose a reason for hiding this comment

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

Awesome find! Nice work @hariombalhara 🙏

@hariombalhara hariombalhara marked this pull request as ready for review April 11, 2024 03:42
@graphite-app graphite-app bot requested a review from a team April 11, 2024 03:42
@dosubot dosubot bot added booking-page area: booking page, public booking page, booker 🐛 bug Something isn't working labels Apr 11, 2024
Copy link

graphite-app bot commented Apr 11, 2024

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (04/11/24)

1 reviewer was added to this PR based on Keith Williams's automation.

@@ -234,7 +239,7 @@ async function moveTeam({
await addTeamRedirect({
oldTeamSlug: team.slug,
teamSlug: newSlug,
orgSlug: org.slug,
orgSlug: org.slug || (orgMetadata?.requestedSlug ?? null),
Copy link
Member Author

Choose a reason for hiding this comment

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

Found this while doing test that in case payment is required for the organization(which is true for cal.com), org.slug won't be set and thus we need to fallback to requestedSlug

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.

LGTM

@emrysal emrysal merged commit aa2808d into main Apr 11, 2024
40 checks passed
@emrysal emrysal deleted the 04-10-fix_broken_ssr_for_event_type_pages branch April 11, 2024 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
booking-page area: booking page, public booking page, booker 🐛 bug Something isn't working consumer core area: core, team members only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants