Skip to content

chore: Proposal for new module based file structure#13396

Merged
zomars merged 8 commits intomainfrom
zomars/cal-3016-new-file-module-structure-proposal
Jan 26, 2024
Merged

chore: Proposal for new module based file structure#13396
zomars merged 8 commits intomainfrom
zomars/cal-3016-new-file-module-structure-proposal

Conversation

@zomars
Copy link
Copy Markdown
Contributor

@zomars zomars commented Jan 24, 2024

What does this PR do?

Extracts bookings related routes into it's own module in apps/web

Why?

In a recent call with @DmytroHryshyn and @grzpab from the Codemod team we found out some of reasons we're experiencing crashes is because of mixed imports and circular dependencies. This PR propose a file structure that will help mitigate this and get these benefits:

  • Benefit from a feature driven structure inside apps/web
  • We can re-export them in both pages and future app routes until migration is completed
  • Prevent OOM issues due to mixed imports
  • Prevent errors due to circular dependencies.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)

How should this be tested?

  • yarn build
  • app and pages routes should be working as expected:
  • /bookings
  • /future/bookings
  • /booking/[uid]
  • /future/booking/[uid]

Mandatory Tasks

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

Checklist

  • I haven't added tests that prove my fix is effective or that my feature works

@linear
Copy link
Copy Markdown

linear Bot commented Jan 24, 2024

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 24, 2024

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

Name Status Preview Comments Updated (UTC)
ai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 25, 2024 10:49pm
api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 25, 2024 10:49pm
dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 25, 2024 10:49pm
5 Ignored Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Jan 25, 2024 10:49pm
cal-demo ⬜️ Ignored (Inspect) Visit Preview Jan 25, 2024 10:49pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Jan 25, 2024 10:49pm
qa ⬜️ Ignored (Inspect) Visit Preview Jan 25, 2024 10:49pm
ui ⬜️ Ignored (Inspect) Visit Preview Jan 25, 2024 10:49pm

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 24, 2024

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

@keithwillcode keithwillcode added api area: API, enterprise API, access token, OAuth core area: core, team members only foundation labels Jan 24, 2024
@keithwillcode keithwillcode added this to the v3.8 milestone Jan 24, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 24, 2024

📦 Next.js Bundle Analysis for @calcom/web

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

This PR introduced no changes to the JavaScript bundle! 🙌

@deploysentinel
Copy link
Copy Markdown

deploysentinel Bot commented Jan 24, 2024

Current Playwright Test Results Summary

✅ 406 Passing - ❌ 1 Failing - ⚠️ 30 Flaky

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

(Last updated on 01/25/2024 10:10:53pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 24bb8bc

Started: 01/25/2024 10:01:25pm UTC

❌ Failures

📄   apps/web/playwright/login.e2e.ts • 1 Failure

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 2Retry 1Initial Attempt
Error: page.goto: net::ERR_ABORTED at http://localhost:3000/...
page.goto: net::ERR_ABORTED at http://localhost:3000/
=========================== logs ===========================
navigating to "http://localhost:3000/", waiting until "load"
============================================================
38.54% (74) 74 / 192 runs
failed over last 7 days
32.29% (62) 62 / 192 runs
flaked over last 7 days

⚠️ Flakes

📄   apps/web/playwright/booking/selectQuestion.e2e.ts • 1 Flake

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 Radio group Question Select and Radio group not required
Retry 1Initial Attempt
0% (0) 0 / 357 runs
failed over last 7 days
2.24% (8) 8 / 357 runs
flaked 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 1280x720 resolution
Retry 1Initial Attempt
0% (0) 0 / 58 runs
failed over last 7 days
1.72% (1) 1 / 58 run
flaked over last 7 days

📄   apps/web/playwright/locale.e2e.ts • 13 Flakes

Top 1 Common Error Messages

null

13 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
unauthorized user sees correct translations (de) should use correct translations and html attributes
Retry 1Initial Attempt
-17.34% (-64) -64 / 369 runs
failed over last 7 days
17.62% (65) 65 / 369 runs
flaked over last 7 days
unauthorized user sees correct translations (ar) should use correct translations and html attributes
Retry 1Initial Attempt
-17.66% (-65) -65 / 368 runs
failed over last 7 days
17.66% (65) 65 / 368 runs
flaked over last 7 days
unauthorized user sees correct translations (zh) should use correct translations and html attributes
Retry 1Initial Attempt
-17.71% (-65) -65 / 367 runs
failed over last 7 days
17.71% (65) 65 / 367 runs
flaked over last 7 days
unauthorized user sees correct translations (zh-CN) should use correct translations and html attributes
Retry 1Initial Attempt
-17.71% (-65) -65 / 367 runs
failed over last 7 days
17.71% (65) 65 / 367 runs
flaked over last 7 days
unauthorized user sees correct translations (zh-TW) should use correct translations and html attributes
Retry 1Initial Attempt
-17.71% (-65) -65 / 367 runs
failed over last 7 days
17.71% (65) 65 / 367 runs
flaked over last 7 days
unauthorized user sees correct translations (pt) should use correct translations and html attributes
Retry 1Initial Attempt
-17.71% (-65) -65 / 367 runs
failed over last 7 days
17.71% (65) 65 / 367 runs
flaked over last 7 days
unauthorized user sees correct translations (pt-br) should use correct translations and html attributes
Retry 1Initial Attempt
-17.71% (-65) -65 / 367 runs
failed over last 7 days
17.71% (65) 65 / 367 runs
flaked over last 7 days
unauthorized user sees correct translations (es-419) should use correct translations and html attributes
Retry 1Initial Attempt
-17.71% (-65) -65 / 367 runs
failed over last 7 days
17.71% (65) 65 / 367 runs
flaked over last 7 days
authorized user sees correct translations (de) should return correct translations and html attributes
Retry 1Initial Attempt
-17.76% (-65) -65 / 366 runs
failed over last 7 days
17.76% (65) 65 / 366 runs
flaked over last 7 days
authorized user sees correct translations (pt-br) should return correct translations and html attributes
Retry 1Initial Attempt
-17.76% (-65) -65 / 366 runs
failed over last 7 days
17.76% (65) 65 / 366 runs
flaked over last 7 days
authorized user sees correct translations (ar) should return correct translations and html attributes
Retry 1Initial Attempt
-17.76% (-65) -65 / 366 runs
failed over last 7 days
17.76% (65) 65 / 366 runs
flaked over last 7 days
authorized user sees changed translations (de->ar) should return correct translations and html attributes
Retry 1Initial Attempt
-6.63% (-24) -24 / 362 runs
failed over last 7 days
16.02% (58) 58 / 362 runs
flaked over last 7 days
authorized user sees changed translations (de->pt-BR) [locale1] should return correct translations and html attributes
Retry 1Initial Attempt
-8.54% (-28) -28 / 328 runs
failed over last 7 days
17.38% (57) 57 / 328 runs
flaked over last 7 days

📄   apps/web/playwright/insights.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Insights should be able to go to insights as members
Retry 1Initial Attempt
0.26% (1) 1 / 386 run
failed over last 7 days
3.11% (12) 12 / 386 runs
flaked over last 7 days

📄   apps/web/playwright/booking/addressQuestione2e/addressQuestion.e2e.ts • 1 Flake

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 Number Question Address required and Number required
Retry 1Initial Attempt
0.85% (3) 3 / 353 runs
failed over last 7 days
2.83% (10) 10 / 353 runs
flaked over last 7 days

📄   apps/web/playwright/availability.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Availablity tests Date Overrides
Retry 1Initial Attempt
0.72% (3) 3 / 417 runs
failed over last 7 days
3.36% (14) 14 / 417 runs
flaked over last 7 days

📄   apps/web/playwright/organization/organization-invitation.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Organization Email matching orgAutoAcceptEmail and a Verified Organization Org Invitation
Retry 1Initial Attempt
2.07% (8) 8 / 387 runs
failed over last 7 days
10.85% (42) 42 / 387 runs
flaked over last 7 days

📄   apps/web/playwright/app-store.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
App Store - Unauthed Browse apple-calendar and try to install
Retry 1Initial Attempt
0% (0) 0 / 419 runs
failed over last 7 days
0.72% (3) 3 / 419 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
1.50% (6) 6 / 399 runs
failed over last 7 days
55.14% (220) 220 / 399 runs
flaked over last 7 days
Popup Tests should be able to reschedule
Retry 1Initial Attempt
-106.91% (-201) -201 / 188 runs
failed over last 7 days
124.47% (234) 234 / 188 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
-108.60% (-202) -202 / 186 runs
failed over last 7 days
121.51% (226) 226 / 186 runs
flaked over last 7 days
Popup Tests should open Routing Forms embed on click
Retry 1Initial Attempt
-109.68% (-204) -204 / 186 runs
failed over last 7 days
115.05% (214) 214 / 186 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
-109.14% (-203) -203 / 186 runs
failed over last 7 days
109.14% (203) 203 / 186 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
-109.14% (-203) -203 / 186 runs
failed over last 7 days
109.14% (203) 203 / 186 runs
flaked over last 7 days
Popup Tests prendered embed should be loaded and apply the config given to it
Retry 1Initial Attempt
-109.19% (-202) -202 / 185 runs
failed over last 7 days
109.73% (203) 203 / 185 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
-109.14% (-203) -203 / 186 runs
failed over last 7 days
109.14% (203) 203 / 186 runs
flaked over last 7 days

📄   packages/app-store/routing-forms/playwright/tests/basic.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
Routing Forms Seeded Routing Form Routing Link - Reporting and CSV Download
Retry 1Initial Attempt
0% (0) 0 / 403 runs
failed over last 7 days
1.74% (7) 7 / 403 runs
flaked over last 7 days
Routing Forms Seeded Routing Form Routing Link should validate fields
Retry 1Initial Attempt
0% (0) 0 / 403 runs
failed over last 7 days
7.94% (32) 32 / 403 runs
flaked over last 7 days

View Detailed Build Results


@zomars zomars requested a review from a team January 24, 2024 21:07
@zomars zomars marked this pull request as ready for review January 24, 2024 21:07
Copy link
Copy Markdown
Contributor Author

@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.

Ready for review

Comment on lines +6 to +7
import { type PageProps } from "~/bookings/views/bookings-single-view";
import { getServerSideProps } from "~/bookings/views/bookings-single-view.getServerSideProps";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Separated both page and SSR code so future pages can import the page by itself and avoiding double bundling.


import PageWrapper from "@components/PageWrapper";
import CancelBooking from "@components/booking/CancelBooking";
import EventReservationSchema from "@components/schemas/EventReservationSchema";

export { getServerSideProps };
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We don't need to export from here. It will be exported directly in the pages route.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The page itself will live in bookings/views/bookings-listing-view so it can be exported both from pages and app routes.

Comment on lines +5 to +6
import OldPage from "~/bookings/views/bookings-single-view";
import { getServerSideProps, type PageProps } from "~/bookings/views/bookings-single-view.getServerSideProps";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This avoids circular dependencies between pages and app

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Extracted reused constant

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is just the bookings page (or view IMO) without the server side code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This now lives in apps/web/modules/bookings/views/bookings-listing-view.tsx

@PeerRich PeerRich added High priority Created by Linear-GitHub Sync and removed Medium priority Created by Linear-GitHub Sync labels Jan 25, 2024
Comment thread apps/web/modules/bookings/views/bookings-listing-view.tsx Outdated
Comment thread apps/web/pages/booking/[uid]/embed.tsx Outdated
keithwillcode
keithwillcode previously approved these changes Jan 25, 2024
@zomars
Copy link
Copy Markdown
Contributor Author

zomars commented Jan 25, 2024

addressed feedback. Please re-review @keithwillcode 🙏🏽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api area: API, enterprise API, access token, OAuth core area: core, team members only foundation High priority Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants