Skip to content

feat: show routing trace dialog on assignment reason badge click#27629

Merged
joeauyeung merged 2 commits intomainfrom
devin/1770227277-routing-trace-dialog
Feb 9, 2026
Merged

feat: show routing trace dialog on assignment reason badge click#27629
joeauyeung merged 2 commits intomainfrom
devin/1770227277-routing-trace-dialog

Conversation

@joeauyeung
Copy link
Copy Markdown
Contributor

@joeauyeung joeauyeung commented Feb 4, 2026

What does this PR do?

This PR adds the ability to view the routing trace dialog when clicking on the assignment reason badge in two places:

  1. BookingListItem - When a booking has an assignment reason, clicking the badge now opens the RoutingTraceSheet to show the routing trace details
  2. Booking Single View Page - Added a clickable assignment reason badge that opens the RoutingTraceSheet, only visible to users with permission to view hidden data (hosts and team members)

The existing RoutingTraceSheet component is reused in both locations.

Updates since last revision

  • Fixed duplicate RoutingTraceSheet rendering issue: The sheet was being rendered in both BookingListItem.tsx and BookingActionsDropdown.tsx, causing duplicate sheets and double data fetches when clicking the badge
  • Moved RoutingTraceSheet rendering to only BookingActionsDropdown.tsx with condition booking.assignmentReason.length > 0
  • Removed redundant RoutingTraceSheet from BookingListItem.tsx (the click handler still works via shared store state)

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - no documentation changes needed.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Create a booking that was routed through a routing form (so it has an assignment reason)
  2. Navigate to the bookings list view
  3. Click on the assignment reason badge on a booking item - the routing trace sheet should open
  4. Verify only one sheet opens (not duplicates)
  5. Navigate to the booking single view page (click on a booking to view details)
  6. If you are the host or a team member, you should see the assignment reason section
  7. Click on the assignment reason badge - the routing trace sheet should open

Permission check: The routing trace on the booking single view page should only be visible to users who have canViewHiddenData permission (hosts and team members).

Human Review Checklist

  • Verify clicking assignment reason badge in BookingListItem opens the RoutingTraceSheet correctly (via shared store state with BookingActionsDropdown)
  • Confirm no duplicate sheets appear when clicking the badge
  • Verify the condition booking.assignmentReason.length > 0 is appropriate for showing the routing trace

Checklist

  • My code follows the style guidelines of this project
  • I have checked if my changes generate no new warnings

Link to Devin run: https://app.devin.ai/sessions/a8b6f7773b174705b0e378f642de1e45
Requested by: @joeauyeung


Open with Devin

Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

{bookingInfo.assignmentReason[0].reasonString}
</p>
)}
<RoutingTraceSheet
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.

There's already a check in place to only show the assignment reason to people who have permission to view it.

@joeauyeung joeauyeung marked this pull request as ready for review February 4, 2026 18:50
@graphite-app graphite-app bot requested a review from a team February 4, 2026 18:50
@graphite-app graphite-app bot added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Feb 4, 2026
Copy link
Copy Markdown
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.

1 issue found across 2 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/web/components/booking/BookingListItem.tsx">

<violation number="1" location="apps/web/components/booking/BookingListItem.tsx:542">
P2: RoutingTraceSheet is now rendered twice for routing-form bookings (once here and once in BookingActionsDropdown), so clicking the badge will open duplicate sheets and double data fetches. Render only one instance per booking.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 4, 2026

Devin AI is addressing Cubic AI's review feedback

New feedback has been sent to the existing Devin session.

View Devin Session


✅ No changes pushed (confidence score 7/10 is below 9/10 threshold)

- Remove RoutingTraceSheet from BookingListItem.tsx to avoid duplicate rendering
- Move RoutingTraceSheet in BookingActionsDropdown.tsx outside of isBookingFromRoutingForm condition
- Use booking.assignmentReason.length > 0 condition for RoutingTraceSheet rendering
- Remove unused isOpenRoutingTraceSheet getter and RoutingTraceSheet import from BookingListItem.tsx

Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
@pull-request-size pull-request-size bot added size/M and removed size/S labels Feb 4, 2026
bookingUid={booking.uid}
routingReason={booking.assignmentReason[0]?.reasonString ?? null}
guestEmail={booking.attendees[0]?.email ?? ""}
hostEmail={booking.user?.email ?? ""}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are we just considering booking.user?.email as host? In a round robin event there could be some fixed hosts as well so more than one hosts are also possible

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Dropdown 'Routing Trace' menu item guarded by different condition than RoutingTraceSheet, causing no-op click

In BookingActionsDropdown.tsx, the "Routing Trace" dropdown menu item at line 678 is conditionally rendered using isBookingFromRoutingForm (which requires !!booking.routedFromRoutingFormReponse && !!booking.eventType?.team), but the RoutingTraceSheet component at line 469 is now rendered using booking.assignmentReason.length > 0. These are independent conditions that can diverge.

Root Cause

Before this PR, both the menu item and the RoutingTraceSheet were inside the same {isBookingFromRoutingForm && (...)} block, so they always appeared together. The PR moved RoutingTraceSheet out to use booking.assignmentReason.length > 0 as its guard (line 469), but left the dropdown menu item at line 678 using the old isBookingFromRoutingForm condition.

When isBookingFromRoutingForm is true but booking.assignmentReason is empty (e.g., a routing-form booking without a recorded assignment reason), the user sees the "Routing Trace" menu item in the dropdown and can click it (setIsOpenRoutingTraceSheet(true) fires at line 685), but no RoutingTraceSheet component is rendered to respond to that state change. The click does nothing.

Impact: Users see a clickable "Routing Trace" action that silently does nothing for routing-form bookings without assignment reasons.

(Refers to lines 678-691)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@joeauyeung joeauyeung merged commit 82a4780 into main Feb 9, 2026
63 checks passed
@joeauyeung joeauyeung deleted the devin/1770227277-routing-trace-dialog branch February 9, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ready-for-e2e size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants