Skip to content

Commit 5476c38

Browse files
fix: filter KBar bookings to show only current user's upcoming bookings (calcom#27447)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 5a7ce63 commit 5476c38

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

apps/web/modules/shell/Kbar.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { useSession } from "next-auth/react";
2+
13
import { appStoreMetadata } from "@calcom/app-store/appStoreMetaData";
24
import dayjs from "@calcom/dayjs";
35
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -265,18 +267,22 @@ function useEventTypesAction(): void {
265267

266268
function useUpcomingBookingsAction(): void {
267269
const router = useRouter();
270+
const session = useSession();
271+
const userId = session.data?.user.id;
268272

269273
const { data } = trpc.viewer.bookings.get.useQuery(
270274
{
271275
filters: {
272276
status: "upcoming",
273277
afterStartDate: dayjs().startOf("day").toISOString(),
278+
userIds: userId ? [userId] : undefined,
274279
},
275280
limit: 100,
276281
},
277282
{
278283
refetchOnWindowFocus: false,
279284
staleTime: 5 * 60 * 1000,
285+
enabled: !!userId,
280286
}
281287
);
282288

0 commit comments

Comments
 (0)