-
Notifications
You must be signed in to change notification settings - Fork 11.2k
fix: troubleshooter team events + improve race condition #25704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| event: null, | ||
| setEvent: (event: EventType) => { | ||
| set({ event }); | ||
| updateQueryParam("eventType", event.slug ?? ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets use IDs now instead of slugs as if teams had the same slug on events i.e /marketing - this would break the selector
| export const listWithTeamHandler = async ({ ctx }: ListWithTeamOptions) => { | ||
| const userId = ctx.user.id; | ||
| const query = Prisma.sql`SELECT "public"."EventType"."id", "public"."EventType"."teamId", "public"."EventType"."title", "public"."EventType"."slug", "j1"."name" as "teamName" | ||
| const query = Prisma.sql`SELECT "public"."EventType"."id", "public"."EventType"."teamId", "public"."EventType"."title", "public"."EventType"."slug", "public"."EventType"."length", "j1"."name" as "teamName" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need length here for troubleshooter on team events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing really changed in this file other than the way we select from store - fixes a race condition
There was a problem hiding this 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 5 files
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/features/troubleshooter/components/EventTypeSelect.tsx">
<violation number="1" location="packages/features/troubleshooter/components/EventTypeSelect.tsx:77">
P2: Missing fallback when `eventTypeId` from URL is not found. The original code fell back to the first event type when the query param event wasn't found, but this behavior was removed. Users with invalid/stale `eventTypeId` query params will see no event selected.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| duration: option.duration, | ||
| }); | ||
| const foundEventType = eventTypes?.find((et) => et.id === option.id); | ||
| if (foundEventType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Missing fallback when eventTypeId from URL is not found. The original code fell back to the first event type when the query param event wasn't found, but this behavior was removed. Users with invalid/stale eventTypeId query params will see no event selected.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/features/troubleshooter/components/EventTypeSelect.tsx, line 77:
<comment>Missing fallback when `eventTypeId` from URL is not found. The original code fell back to the first event type when the query param event wasn't found, but this behavior was removed. Users with invalid/stale `eventTypeId` query params will see no event selected.</comment>
<file context>
@@ -7,67 +8,80 @@ import { getQueryParam } from "../../bookings/Booker/utils/query-param";
- duration: option.duration,
- });
+ const foundEventType = eventTypes?.find((et) => et.id === option.id);
+ if (foundEventType) {
+ setSelectedEventType({
+ id: foundEventType.id,
</file context>
alishaz-polymath
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
What does this PR do?
Fixes: CAL-6882
How should this be tested?
Create a team event - book a meeting
load troubleshooter and see that we can see events on troubleshooter + select team events from sidebar
Checklist
Summary by cubic
Show team event types in the Troubleshooter and fix a race condition so selected events load reliably. Addresses CAL-6882 by displaying team events in the sidebar and calendar.
Bug Fixes
Migration
Written for commit 288b576. Summary will update automatically on new commits.