chore: [app dir bootstrapping 4.1] check nullability of navigation hook return values part 2 (#12065)

Co-authored-by: Omar López <zomars@me.com>
pull/12070/head
Greg Pabian 2023-10-24 22:52:59 +02:00 committed by GitHub
parent 0ae6506bc1
commit a9535d3fd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -47,7 +47,7 @@ export function OverlayCalendarSettingsModal(props: IOverlayCalendarContinueModa
const searchParams = useSearchParams(); const searchParams = useSearchParams();
const setOverlayBusyDates = useOverlayCalendarStore((state) => state.setOverlayBusyDates); const setOverlayBusyDates = useOverlayCalendarStore((state) => state.setOverlayBusyDates);
const { data, isLoading } = trpc.viewer.connectedCalendars.useQuery(undefined, { const { data, isLoading } = trpc.viewer.connectedCalendars.useQuery(undefined, {
enabled: !!props.open || !!searchParams.get("overlayCalendar"), enabled: !!props.open || Boolean(searchParams?.get("overlayCalendar")),
}); });
const { toggleValue, hasItem, set } = useLocalSet<{ const { toggleValue, hasItem, set } = useLocalSet<{
credentialId: number; credentialId: number;

View File

@ -94,7 +94,7 @@ const PaymentForm = (props: Props) => {
location?: string; location?: string;
} = { } = {
uid: props.booking.uid, uid: props.booking.uid,
email: searchParams.get("email"), email: searchParams?.get("email"),
}; };
if (paymentOption === "HOLD" && "setupIntent" in props.payment.data) { if (paymentOption === "HOLD" && "setupIntent" in props.payment.data) {
payload = await stripe.confirmSetup({ payload = await stripe.confirmSetup({

View File

@ -61,7 +61,7 @@ function useRouterHelpers() {
const pathname = usePathname(); const pathname = usePathname();
const goto = (newSearchParams: Record<string, string>) => { const goto = (newSearchParams: Record<string, string>) => {
const newQuery = new URLSearchParams(searchParams); const newQuery = new URLSearchParams(searchParams ?? undefined);
Object.keys(newSearchParams).forEach((key) => { Object.keys(newSearchParams).forEach((key) => {
newQuery.set(key, newSearchParams[key]); newQuery.set(key, newSearchParams[key]);
}); });
@ -70,7 +70,7 @@ function useRouterHelpers() {
}; };
const removeQueryParams = (queryParams: string[]) => { const removeQueryParams = (queryParams: string[]) => {
const params = new URLSearchParams(searchParams); const params = new URLSearchParams(searchParams ?? undefined);
queryParams.forEach((param) => { queryParams.forEach((param) => {
params.delete(param); params.delete(param);
@ -529,7 +529,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
); );
const s = (href: string) => { const s = (href: string) => {
const _searchParams = new URLSearchParams(searchParams); const _searchParams = new URLSearchParams(searchParams ?? undefined);
const [a, b] = href.split("="); const [a, b] = href.split("=");
_searchParams.set(a, b); _searchParams.set(a, b);
return `${pathname?.split("?")[0] ?? ""}?${_searchParams.toString()}`; return `${pathname?.split("?")[0] ?? ""}?${_searchParams.toString()}`;

View File

@ -2,13 +2,13 @@ import type { AppCategories, Prisma } from "@prisma/client";
import appStore from "@calcom/app-store"; import appStore from "@calcom/app-store";
import type { EventTypeAppsList } from "@calcom/app-store/utils"; import type { EventTypeAppsList } from "@calcom/app-store/utils";
import type { EventTypeModel } from "@calcom/prisma/zod"; import type { CompleteEventType } from "@calcom/prisma/zod";
import type { CalendarEvent } from "@calcom/types/Calendar"; import type { CalendarEvent } from "@calcom/types/Calendar";
import type { IAbstractPaymentService, PaymentApp } from "@calcom/types/PaymentService"; import type { IAbstractPaymentService, PaymentApp } from "@calcom/types/PaymentService";
const handlePayment = async ( const handlePayment = async (
evt: CalendarEvent, evt: CalendarEvent,
selectedEventType: Pick<Zod.infer<typeof EventTypeModel>, "metadata" | "title">, selectedEventType: Pick<CompleteEventType, "metadata" | "title">,
paymentAppCredentials: { paymentAppCredentials: {
key: Prisma.JsonValue; key: Prisma.JsonValue;
appId: EventTypeAppsList; appId: EventTypeAppsList;