Skip to content

Comments

fix: week view and column view slots not fetching at end of month bug#24374

Merged
emrysal merged 5 commits intomainfrom
fix-week-view-bug
Oct 9, 2025
Merged

fix: week view and column view slots not fetching at end of month bug#24374
emrysal merged 5 commits intomainfrom
fix-week-view-bug

Conversation

@Ryukemeister
Copy link
Contributor

@Ryukemeister Ryukemeister commented Oct 8, 2025

No description provided.

@keithwillcode keithwillcode added core area: core, team members only platform Anything related to our platform plan labels Oct 8, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 8, 2025

Walkthrough

  • BookerWebWrapper: selectedDate source changed from URL parameter to state.selectedDate via useBookerStoreContext; downstream formatting uses this store value.
  • CalendarViewPlatformWrapper: introduced usePrefetch to supply prefetchNextMonth and monthCount; removed in-component prefetch calculations. Removed view prop and related layout logic; initialization now passes a fixed layout value "week_view". Updated data flow to remove dependence on previous layout-derived variables and mapping.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request does not include any description to explain the changes or context, so there is no information about the scope or details of the fix. Please add a concise description outlining the bug being fixed, the affected components, and an overview of the implemented changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and succinctly identifies the specific bug being fixed in week and column views at month end, follows conventional commit style, and directly reflects the main purpose of the changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-week-view-bug

📜 Recent 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 bec49ef and 99055fe.

📒 Files selected for processing (2)
  • packages/platform/atoms/booker/BookerWebWrapper.tsx (1 hunks)
  • packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.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:

  • packages/platform/atoms/booker/BookerWebWrapper.tsx
  • packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.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:

  • packages/platform/atoms/booker/BookerWebWrapper.tsx
  • packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx
**/*.{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/booker/BookerWebWrapper.tsx
  • packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx
🧠 Learnings (2)
📚 Learning: 2025-09-18T13:38:50.958Z
Learnt from: hariombalhara
PR: calcom/cal.com#23913
File: packages/features/bookings/Booker/components/hooks/usePrefetch.ts:43-50
Timestamp: 2025-09-18T13:38:50.958Z
Learning: In usePrefetch hook in packages/features/bookings/Booker/components/hooks/usePrefetch.ts, the !isNaN() checks before comparing monthAfterAdding1Month !== monthAfterAddingExtraDaysColumnView are intentional to prevent the NaN !== NaN issue where NaN values would incorrectly be considered different, leading to wrong monthCount calculations.

Applied to files:

  • packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx
📚 Learning: 2025-07-15T12:59:34.389Z
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.

Applied to files:

  • packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx
🧬 Code graph analysis (2)
packages/platform/atoms/booker/BookerWebWrapper.tsx (1)
packages/features/bookings/Booker/BookerStoreProvider.tsx (1)
  • useBookerStoreContext (24-35)
packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx (1)
packages/features/bookings/Booker/components/hooks/usePrefetch.ts (1)
  • usePrefetch (16-56)
⏰ 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)
packages/platform/atoms/booker/BookerWebWrapper.tsx (1)

58-58: LGTM! Store context resolves param detection issue.

Reading selectedDate from the Booker store context instead of URL parameters correctly addresses the NextJS param update detection issue mentioned in the past review comment. This ensures the selected date stays synchronized with the store state.

packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx (2)

14-14: LGTM! Centralized prefetch logic.

The usePrefetch hook correctly centralizes the month/prefetch calculations. The hook receives the proper parameters (date, month, bookerLayout, bookerState) and the returned values (prefetchNextMonth, monthCount) are correctly consumed by useTimesForSchedule at lines 85-91. This should fix the end-of-month slot fetching issue mentioned in the PR title.

Based on learnings: The NaN checks in usePrefetch (from the relevant code snippet) are intentional to handle the NaN !== NaN comparison issue when calculating monthCount.

Also applies to: 78-83


148-148: LGTM! Fixed layout is intentional.

Hardcoding the layout to "week_view" is correct for this calendar view wrapper, as confirmed by the past review 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.

@vercel
Copy link

vercel bot commented Oct 9, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Oct 9, 2025 9:49am
cal-eu Ignored Ignored Oct 9, 2025 9:49am

@pull-request-size pull-request-size bot added size/S and removed size/XS labels Oct 9, 2025

const bookerLayout = useBookerLayout(event.data?.profile?.bookerLayouts);
const selectedDate = searchParams?.get("date");
const selectedDate = useBookerStoreContext((state) => state.selectedDate);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is an issue with this approach, what happens is we pick date from search params and that value is correct, but when the params are updated nextjs is not able to detect this param updation so the value of selectedDate never changes. hence we can use selectedDate from useBookerStoreContext instead

rescheduleUid: props.rescheduleUid ?? null,
bookingUid: props.bookingUid ?? null,
layout: layout,
layout: "week_view",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we know this is always gonna be week view hence we hardcode the layout as week_view

@Ryukemeister Ryukemeister marked this pull request as ready for review October 9, 2025 09:49
@Ryukemeister Ryukemeister requested a review from a team October 9, 2025 09:49
@Ryukemeister Ryukemeister requested a review from a team as a code owner October 9, 2025 09:49
@dosubot dosubot bot added the 🐛 bug Something isn't working label Oct 9, 2025
@Ryukemeister Ryukemeister requested a review from supalarry October 9, 2025 09:56
Copy link
Contributor

@supalarry supalarry left a comment

Choose a reason for hiding this comment

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

Great fix!

@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2025

E2E results are ready!

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.

Looks good to me 👍

@emrysal emrysal merged commit 445b307 into main Oct 9, 2025
79 of 84 checks passed
@emrysal emrysal deleted the fix-week-view-bug branch October 9, 2025 12:57
joeauyeung pushed a commit that referenced this pull request Oct 9, 2025
…#24374)

* fix: dont pick date value from url, use selectedDate value from booker store instead

* fix: replace month count logic with usePrefectch hook

* intialise booker layout as week view
@coderabbitai coderabbitai bot mentioned this pull request Oct 15, 2025
3 tasks
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 platform Anything related to our platform plan ready-for-e2e size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants