Skip to content

fix: a.trim is not a function type error #22710

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

Merged
merged 1 commit into from
Jul 24, 2025
Merged

Conversation

anikdhabal
Copy link
Contributor

@anikdhabal anikdhabal commented Jul 24, 2025

What does this PR do?

Screenshot 2025-07-23 at 11 34 08

Copy link

vercel bot commented Jul 24, 2025

@anikdhabal is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot requested a review from a team July 24, 2025 06:07
Copy link
Contributor

coderabbitai bot commented Jul 24, 2025

Walkthrough

The logic for determining the isCalVideoLocation property in the BookingListItem component was updated. The new implementation adds an explicit type check to ensure booking.location is a string before invoking the trim() method. This adjustment prevents potential runtime errors when booking.location is not a string and refines the condition used to identify Cal.com video locations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/components/booking/BookingListItem.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-playwright".

(The package "eslint-plugin-playwright" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-playwright@latest --save-dev

The plugin "eslint-plugin-playwright" was referenced from the config file in ".eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 611f76b and ed6d847.

📒 Files selected for processing (1)
  • apps/web/components/booking/BookingListItem.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code. Functions like .add, .diff, .isBefore, and .isAfter are slow, especially in timezone mode. Prefer .utc() for better performance. Where possible, replace with native Date and direct .valueOf() comparisons for faster execution. Recommend using native methods or Day.js .utc() consistently in hot paths like loops.

Files:

  • apps/web/components/booking/BookingListItem.tsx
🧠 Learnings (2)
📓 Common learnings
Learnt from: Anshumancanrock
PR: calcom/cal.com#22570
File: apps/web/modules/signup-view.tsx:253-253
Timestamp: 2025-07-21T21:33:23.343Z
Learning: In signup-view.tsx, when checking if redirectUrl contains certain strings, using explicit && checks (redirectUrl && redirectUrl.includes()) is preferred over optional chaining (redirectUrl?.includes()) to ensure the result is always a boolean rather than potentially undefined. This approach provides cleaner boolean contracts for downstream conditional logic.
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.
Learnt from: hariombalhara
PR: calcom/cal.com#22547
File: packages/embeds/embed-core/src/lib/eventHandlers/scrollByDistanceEventHandler.ts:11-14
Timestamp: 2025-07-16T11:46:28.759Z
Learning: In Cal.com's embed system, internal events like "__scrollByDistance" are fired by Cal.com's own code, so runtime validation of event data structure is unnecessary since TypeScript type system guarantees type safety for internal events.
apps/web/components/booking/BookingListItem.tsx (3)

Learnt from: eunjae-lee
PR: #22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.

Learnt from: Anshumancanrock
PR: #22570
File: apps/web/modules/signup-view.tsx:253-253
Timestamp: 2025-07-21T21:33:23.343Z
Learning: In signup-view.tsx, when checking if redirectUrl contains certain strings, using explicit && checks (redirectUrl && redirectUrl.includes()) is preferred over optional chaining (redirectUrl?.includes()) to ensure the result is always a boolean rather than potentially undefined. This approach provides cleaner boolean contracts for downstream conditional logic.

Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-21T13:54:11.770Z
Learning: Applies to frontend/**/*.{js,jsx,ts,tsx} : Always use t() for text localization in frontend code; direct text embedding should trigger a warning.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (110)
  • GitHub Check: Tests / E2E (2/4)
  • GitHub Check: Analyze Build / analyze
  • GitHub Check: Tests / E2E Embed React
  • GitHub Check: Tests / E2E (3/4)
  • GitHub Check: Tests / E2E (4/4)
  • GitHub Check: Tests / E2E App Store
  • GitHub Check: Tests / E2E Embed Core
  • GitHub Check: Tests / E2E (1/4)
  • GitHub Check: Tests / Integration
  • GitHub Check: Tests / E2E API v2
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Tests / E2E (2/4)
  • GitHub Check: Analyze Build / analyze
  • GitHub Check: Tests / E2E Embed React
  • GitHub Check: Tests / E2E (3/4)
  • GitHub Check: Tests / E2E (4/4)
  • GitHub Check: Tests / E2E App Store
  • GitHub Check: Tests / E2E Embed Core
  • GitHub Check: Tests / E2E (1/4)
  • GitHub Check: Tests / Integration
  • GitHub Check: Tests / E2E API v2
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Tests / E2E (2/4)
  • GitHub Check: Analyze Build / analyze
  • GitHub Check: Tests / E2E Embed React
  • GitHub Check: Tests / E2E (3/4)
  • GitHub Check: Tests / E2E (4/4)
  • GitHub Check: Tests / E2E App Store
  • GitHub Check: Tests / E2E Embed Core
  • GitHub Check: Tests / E2E (1/4)
  • GitHub Check: Tests / Integration
  • GitHub Check: Tests / E2E API v2
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Tests / E2E (2/4)
  • GitHub Check: Analyze Build / analyze
  • GitHub Check: Tests / E2E Embed React
  • GitHub Check: Tests / E2E (3/4)
  • GitHub Check: Tests / E2E (4/4)
  • GitHub Check: Tests / E2E App Store
  • GitHub Check: Tests / E2E Embed Core
  • GitHub Check: Tests / E2E (1/4)
  • GitHub Check: Tests / Integration
  • GitHub Check: Tests / E2E API v2
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Tests / E2E (2/4)
  • GitHub Check: Analyze Build / analyze
  • GitHub Check: Tests / E2E Embed React
  • GitHub Check: Tests / E2E (3/4)
  • GitHub Check: Tests / E2E (4/4)
  • GitHub Check: Tests / E2E App Store
  • GitHub Check: Tests / E2E Embed Core
  • GitHub Check: Tests / E2E (1/4)
  • GitHub Check: Tests / Integration
  • GitHub Check: Tests / E2E API v2
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Tests / E2E (2/4)
  • GitHub Check: Analyze Build / analyze
  • GitHub Check: Tests / E2E Embed React
  • GitHub Check: Tests / E2E (3/4)
  • GitHub Check: Tests / E2E (4/4)
  • GitHub Check: Tests / E2E App Store
  • GitHub Check: Tests / E2E Embed Core
  • GitHub Check: Tests / E2E (1/4)
  • GitHub Check: Tests / Integration
  • GitHub Check: Tests / E2E API v2
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Tests / E2E (2/4)
  • GitHub Check: Analyze Build / analyze
  • GitHub Check: Tests / E2E Embed React
  • GitHub Check: Tests / E2E (3/4)
  • GitHub Check: Tests / E2E (4/4)
  • GitHub Check: Tests / E2E App Store
  • GitHub Check: Tests / E2E Embed Core
  • GitHub Check: Tests / E2E (1/4)
  • GitHub Check: Tests / Integration
  • GitHub Check: Tests / E2E API v2
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Tests / E2E (2/4)
  • GitHub Check: Analyze Build / analyze
  • GitHub Check: Tests / E2E Embed React
  • GitHub Check: Tests / E2E (3/4)
  • GitHub Check: Tests / E2E (4/4)
  • GitHub Check: Tests / E2E App Store
  • GitHub Check: Tests / E2E Embed Core
  • GitHub Check: Tests / E2E (1/4)
  • GitHub Check: Tests / Integration
  • GitHub Check: Tests / E2E API v2
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Tests / E2E (2/4)
  • GitHub Check: Analyze Build / analyze
  • GitHub Check: Tests / E2E Embed React
  • GitHub Check: Tests / E2E (3/4)
  • GitHub Check: Tests / E2E (4/4)
  • GitHub Check: Tests / E2E App Store
  • GitHub Check: Tests / E2E Embed Core
  • GitHub Check: Tests / E2E (1/4)
  • GitHub Check: Tests / Integration
  • GitHub Check: Tests / E2E API v2
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Tests / E2E (2/4)
  • GitHub Check: Analyze Build / analyze
  • GitHub Check: Tests / E2E Embed React
  • GitHub Check: Tests / E2E (3/4)
  • GitHub Check: Tests / E2E (4/4)
  • GitHub Check: Tests / E2E App Store
  • GitHub Check: Tests / E2E Embed Core
  • GitHub Check: Tests / E2E (1/4)
  • GitHub Check: Tests / Integration
  • GitHub Check: Tests / E2E API v2
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
apps/web/components/booking/BookingListItem.tsx (1)

247-250: LGTM! Type safety improvement correctly implemented.

The explicit type check before calling trim() prevents runtime errors when booking.location is not a string. This directly addresses the "trim is not a function" error mentioned in the PR objective and follows the defensive programming pattern.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@anikdhabal anikdhabal requested review from Udit-takkar and removed request for a team July 24, 2025 06:08
@keithwillcode keithwillcode added the core area: core, team members only label Jul 24, 2025
@anikdhabal anikdhabal enabled auto-merge (squash) July 24, 2025 06:08
@dosubot dosubot bot added the 🐛 bug Something isn't working label Jul 24, 2025
Copy link

graphite-app bot commented Jul 24, 2025

Graphite Automations

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

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

"Add ready-for-e2e label" took an action on this PR • (07/24/25)

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

Copy link
Contributor

@Devanshusharma2005 Devanshusharma2005 left a comment

Choose a reason for hiding this comment

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

LGTM

@anikdhabal anikdhabal merged commit 3ab6767 into calcom:main Jul 24, 2025
94 of 105 checks passed
zomars pushed a commit that referenced this pull request Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working core area: core, team members only ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants