feat: show routing trace dialog on assignment reason badge click#27629
feat: show routing trace dialog on assignment reason badge click#27629joeauyeung merged 2 commits intomainfrom
Conversation
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| {bookingInfo.assignmentReason[0].reasonString} | ||
| </p> | ||
| )} | ||
| <RoutingTraceSheet |
There was a problem hiding this comment.
There's already a check in place to only show the assignment reason to people who have permission to view it.
There was a problem hiding this comment.
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.
Devin AI is addressing Cubic AI's review feedbackNew feedback has been sent to the existing 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>
| bookingUid={booking.uid} | ||
| routingReason={booking.assignmentReason[0]?.reasonString ?? null} | ||
| guestEmail={booking.attendees[0]?.email ?? ""} | ||
| hostEmail={booking.user?.email ?? ""} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
🟡 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)
Was this helpful? React with 👍 or 👎 to provide feedback.
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:
The existing
RoutingTraceSheetcomponent is reused in both locations.Updates since last revision
BookingListItem.tsxandBookingActionsDropdown.tsx, causing duplicate sheets and double data fetches when clicking the badgeBookingActionsDropdown.tsxwith conditionbooking.assignmentReason.length > 0BookingListItem.tsx(the click handler still works via shared store state)Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Permission check: The routing trace on the booking single view page should only be visible to users who have
canViewHiddenDatapermission (hosts and team members).Human Review Checklist
booking.assignmentReason.length > 0is appropriate for showing the routing traceChecklist
Link to Devin run: https://app.devin.ai/sessions/a8b6f7773b174705b0e378f642de1e45
Requested by: @joeauyeung