Skip to content

Comments

fix: Recurring events set to "yearly" don't recur#24361

Merged
anikdhabal merged 9 commits intocalcom:mainfrom
designed2code:bug-16442
Nov 3, 2025
Merged

fix: Recurring events set to "yearly" don't recur#24361
anikdhabal merged 9 commits intocalcom:mainfrom
designed2code:bug-16442

Conversation

@designed2code
Copy link
Contributor

@designed2code designed2code commented Oct 8, 2025

What does this PR do?

This PR - Fixes #24348 where recurring events set to yearly frequency were not being recognized as recurring events. The issue was caused by a falsy check that failed when freq = 0 (YEARLY enum value).

Root Cause: The condition event.data?.recurringEvent?.freq evaluated to false when the frequency was set to YEARLY (0)
Solution: Updated the conditional checks in useHandleBookEvent.tsx and BookingListItem.tsx from event.data?.recurringEvent?.freq to event.data?.recurringEvent?.freq != null

This explicitly checks for null/undefined while correctly handling the 0 value.

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo

  • Before Fix:-
Before-Fix.mp4
  • After Fix :-
After-Fix.mp4

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code
  • N/A
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

Test Steps:

  1. Create a new event type with recurrence set to yearly and specify multiple iterations (e.g., 5 occurrences).
  2. Book that event type to create a recurring yearly booking.
  3. Confirm the booking.
  4. Navigate to the "Upcoming" bookings tab.
  5. Navigate to the "Recurring" tab.

Expected Results:

  • All 5 yearly instances should be generated and visible in the "Upcoming" bookings list.
  • The "Recurring" tab should display the series details with all occurrences listed.
  • Each yearly occurrence should be properly scheduled (e.g., if first booking is Jan 15, 2025, subsequent ones should be Jan 15, 2026, 2027, etc.).

Before this fix: Yearly recurring events (freq = 0) were not recognized due to falsy check, so only a single booking appeared.

@designed2code designed2code requested a review from a team October 8, 2025 12:53
@designed2code designed2code requested a review from a team as a code owner October 8, 2025 12:53
@vercel
Copy link

vercel bot commented Oct 8, 2025

Someone 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 added the community Created by Linear-GitHub Sync label Oct 8, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2025

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "#fix: Recurring events set to “yearly” don’t recur". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@graphite-app graphite-app bot requested a review from a team October 8, 2025 12:53
@github-actions github-actions bot added reactive⚡︎ 🐛 bug Something isn't working 📉 regressing This used to work. Now it doesn't anymore. labels Oct 8, 2025
@CLAassistant
Copy link

CLAassistant commented Oct 8, 2025

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 8, 2025

Walkthrough

Updated recurrence presence checks and error typing across three files. apps/web/components/booking/BookingListItem.tsx and packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts now test recurringEvent.freq != null instead of a truthy check to allow 0 values. useHandleBookEvent.ts also tightened Callbacks.onError to (err: unknown) => void and updated handleError to read err.message only when err is an Error, falling back to a generic key otherwise. packages/lib/recurringStrings.ts changed getEveryFreqFor to recurringEvent.freq != null. No exported/public API declarations changed.

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the primary fix, addressing yearly recurring events not being recognized, which aligns directly with the changes in conditional checks for freq values.
Linked Issues Check ✅ Passed The updates change conditional checks to use != null for freq across booking generation and UI components, which ensures that yearly events (freq = 0) are correctly recognized, generated, and displayed as required by issues #24348 and CAL-6541.
Out of Scope Changes Check ✅ Passed All changes are focused on correcting the frequency null check and directly relate to the linked issues by enabling yearly recurrences; there are no unrelated or extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed The pull request description clearly outlines the root cause of the issue, references the affected files and conditions, and explains how the change (switching from a truthy check to a != null check) resolves the bug, matching the code modifications and linked issues.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot bot added the bookings area: bookings, availability, timezones, double booking label Oct 8, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 64f811e and 3b62473.

📒 Files selected for processing (2)
  • apps/web/components/booking/BookingListItem.tsx (1 hunks)
  • packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Always use t() for text localization in frontend code; direct text embedding should trigger a warning

Files:

  • apps/web/components/booking/BookingListItem.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • apps/web/components/booking/BookingListItem.tsx
  • packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • apps/web/components/booking/BookingListItem.tsx
  • packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts
🧬 Code graph analysis (1)
packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts (1)
packages/trpc/server/routers/publicViewer/procedures/event.ts (1)
  • event (5-10)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (3)
apps/web/components/booking/BookingListItem.tsx (1)

831-831: LGTM! Critical fix for yearly recurring events.

The change from a truthy check to an explicit null check (!= null) correctly handles the case where freq = 0 (YEARLY enum value in RRule). The previous truthy check incorrectly treated 0 as falsy, causing yearly recurring events to not display their recurring metadata.

packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts (2)

17-17: LGTM! Better error handling type safety.

Changing the error parameter type from any to unknown enforces proper type narrowing before using error properties, which is a TypeScript best practice.


124-124: LGTM! Critical fix for yearly recurring events.

This change from a truthy check to an explicit null check (!= null) correctly resolves the bug where yearly recurring events (freq = 0) were not being routed to handleRecBooking. The previous truthy check incorrectly treated 0 as falsy, preventing yearly recurrences from being created.

@designed2code designed2code changed the title #fix: Recurring events set to “yearly” don’t recur fix: Recurring events set to "yearly" don't recur Oct 8, 2025
@pull-request-size pull-request-size bot added size/S and removed size/XS labels Oct 8, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d5a8b16 and e070633.

📒 Files selected for processing (1)
  • packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Linters / lint
  • GitHub Check: Type check / check-types
  • GitHub Check: Tests / Unit
🔇 Additional comments (2)
packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts (2)

17-17: LGTM! Type safety improvement.

Changing the error callback parameter from any to unknown enforces proper type narrowing before accessing error properties, which aligns with the instanceof Error check introduced in the handleError function.


67-70: LGTM! Error handling properly implemented.

The instanceof Error type guard correctly narrows the unknown type before accessing err.message, preventing unsafe property access. This implementation addresses the concern raised in the previous review.

@dhairyashiil
Copy link
Member

Hello @designed2code , Attach before and after video. also address coderabbit's comment

@designed2code
Copy link
Contributor Author

Hello @dhairyashiil I have

  • added before and after video
  • addressed coderabbit's comment too.

Please check.

Copy link
Member

@dhairyashiil dhairyashiil left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏼 , Thank you for the contribution. I can see this is your first PR in cal. So welcome, feel free to take on issues like this, and ping me in case you need help with anything.

Also for future PRs, please add before and after videos it helps us a lot, I know it causes more work to you but in a way it helps us to approve your PR faster.

@github-actions github-actions bot added the Medium priority Created by Linear-GitHub Sync label Oct 9, 2025
@designed2code
Copy link
Contributor Author

@dhairyashiil Thanks for the welcome and the review. Will remember the videos for next time. Looking forward to contributing more. 🙌🏻

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.

Great spot!

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2025

E2E results are ready!

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

@anikdhabal anikdhabal enabled auto-merge (squash) November 3, 2025 15:41
@anikdhabal anikdhabal merged commit b9c350c into calcom:main Nov 3, 2025
52 of 61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working community Created by Linear-GitHub Sync Medium priority Created by Linear-GitHub Sync reactive⚡︎ ready-for-e2e 📉 regressing This used to work. Now it doesn't anymore. size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] #16442 – Recurring events set to “yearly” don’t recur: (bug) Recurring events set to "yearly" don't recur.

5 participants