Skip to content

Comments

fix: unable to cancel a seated event as a host#24426

Merged
anikdhabal merged 1 commit intomainfrom
got-error-when-cacnelling
Oct 13, 2025
Merged

fix: unable to cancel a seated event as a host#24426
anikdhabal merged 1 commit intomainfrom
got-error-when-cacnelling

Conversation

@anikdhabal
Copy link
Contributor

@anikdhabal anikdhabal commented Oct 13, 2025

What does this PR do?

unable to cancel a seated event as a host from booking action

@graphite-app graphite-app bot requested a review from a team October 13, 2025 07:14
@keithwillcode keithwillcode added the core area: core, team members only label Oct 13, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Walkthrough

The change updates apps/web/components/booking/bookingActions.ts to compute seatReferenceUid once per usage context via getSeatReferenceUid() and store it in a local variable. getCancelEventAction and getEditEventActions now reference this local seatReferenceUid instead of calling getSeatReferenceUid() inline. Inclusion of the seatReferenceUid in cancel and reschedule URLs is now gated by the presence of booking.seatsReferences and the computed seatReferenceUid, with reschedule additionally checking attendee status. No exported/public declarations were altered.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the primary bug fix by noting the issue of canceling a seated event as a host, which directly aligns with the changes in bookingActions.ts that compute and apply the correct seatReferenceUid.
Description Check ✅ Passed The description restates the core issue of hosts being unable to cancel seated events and aligns with the changeset focused on updating booking actions, making it relevant and on-topic for the PR.
✨ 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 got-error-when-cacnelling

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.

@anikdhabal anikdhabal enabled auto-merge (squash) October 13, 2025 07:15
@dosubot dosubot bot added bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working labels Oct 13, 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 b01ceb4 and 476e2c4.

📒 Files selected for processing (1)
  • apps/web/components/booking/bookingActions.ts (2 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:

  • apps/web/components/booking/bookingActions.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:

  • apps/web/components/booking/bookingActions.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/bookingActions.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). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (2)
apps/web/components/booking/bookingActions.ts (2)

67-67: LGTM! Fix properly guards against undefined seatReferenceUid.

Computing seatReferenceUid once and storing it locally is efficient. The defensive check on line 74 ensures the query parameter is only appended when both seatsReferences exist and a valid seatReferenceUid is available, preventing malformed URLs when hosts (who lack seat references) cancel seated events.

Also applies to: 74-74


110-110: LGTM! Appropriate guard with isAttendee check for reschedule action.

The local seatReferenceUid computation and the three-part guard on line 118 are correct. The isAttendee check is particularly appropriate here: attendees need the seat reference to reschedule their specific seat, while hosts reschedule the entire event without requiring a seat-specific reference.

Also applies to: 118-118


export function getCancelEventAction(context: BookingActionContext): ActionType {
const { booking, isTabRecurring, isRecurring, getSeatReferenceUid, t } = context;
const seatReferenceUid = getSeatReferenceUid();
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Verify test coverage for the fix.

The PR description states that automated tests should exist to prove the fix. Please ensure tests cover the scenario where hosts cancel seated events (where getSeatReferenceUid() returns undefined) and verify the generated URLs are correct.

Also applies to: 110-110


🏁 Script executed:

#!/bin/bash
# Description: Search for test files covering booking actions and seat reference handling

# Find test files related to booking actions
fd -e test.ts -e test.tsx -e spec.ts -e spec.tsx . | xargs rg -l "bookingActions|getCancelEventAction|getEditEventActions" -C 2

# Search for tests covering seat reference scenarios
rg -n "seatReferenceUid|seatsReferences" --type=ts --type=tsx -g "*test*" -g "*spec*" -C 3

Length of output: 78


Add tests for undefined seatReferenceUid scenario.

apps/web/components/booking/bookingActions.test.ts doesn’t cover the case when getSeatReferenceUid() returns undefined. Add tests that simulate a host canceling a seated event and verify the generated URLs.

🤖 Prompt for AI Agents
In apps/web/components/booking/bookingActions.ts around line 67, the call to
getSeatReferenceUid() can return undefined but there are no tests covering that
branch; update apps/web/components/booking/bookingActions.test.ts to add a test
that stubs/mocks getSeatReferenceUid() to return undefined, simulates a host
canceling a seated event, invokes the action that builds the cancellation URLs,
and asserts the generated URLs match the expected fallback behavior (e.g., omit
seat reference or use alternative query parameters). Ensure the test resets the
mock after running and includes both URL structure and query param assertions.

@anikdhabal anikdhabal merged commit 5fd55cb into main Oct 13, 2025
101 of 107 checks passed
@anikdhabal anikdhabal deleted the got-error-when-cacnelling branch October 13, 2025 07:38
@github-actions
Copy link
Contributor

E2E results are ready!

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 core area: core, team members only ready-for-e2e size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants