chore: bump @trpc/* and @tanstack/react-query (#13335)

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Omar López <[email protected]>
Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
Co-authored-by: zomars <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: Benny Joo <[email protected]>
Co-authored-by: Carina Wollendorfer <[email protected]>
Co-authored-by: Gergő Móricz <[email protected]>
Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
183 files changed
+1203 -1013

No files matched your search

+11 -6
View File
@@ -5,7 +5,7 @@ import classNames from "classnames";
import { signIn } from "next-auth/react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { useState, useEffect } from "react";
import { FormProvider, useForm } from "react-hook-form";
import { FaGoogle } from "react-icons/fa";
import { z } from "zod";
@@ -157,15 +157,20 @@ inferSSRProps<typeof getServerSideProps> & WithNonceProps<{}>) {
else setErrorMessage(errorMessages[res.error] || t("something_went_wrong"));
};
const { data, isLoading } = trpc.viewer.public.ssoConnections.useQuery(undefined, {
onError: (err) => {
setErrorMessage(err.message);
const { data, isPending, error } = trpc.viewer.public.ssoConnections.useQuery();
useEffect(
function refactorMeWithoutEffect() {
if (error) {
setErrorMessage(error.message);
}
},
});
[error]
);
const displaySSOLogin = HOSTED_CAL_FEATURES
? true
: isSAMLLoginEnabled && !isLoading && data?.connectionExists;
: isSAMLLoginEnabled && !isPending && data?.connectionExists;
return (
<div className="dark:bg-brand dark:text-brand-contrast text-emphasis min-h-screen [--cal-brand-emphasis:#101010] [--cal-brand-subtle:#9CA3AF] [--cal-brand-text:white] [--cal-brand:#111827] dark:[--cal-brand-emphasis:#e1e1e1] dark:[--cal-brand-text:black] dark:[--cal-brand:white]">
+5 -5
View File
@@ -28,7 +28,7 @@ export default function Authorize() {
const [selectedAccount, setSelectedAccount] = useState<{ value: string; label: string } | null>();
const scopes = scope ? scope.toString().split(",") : [];
const { data: client, isLoading: isLoadingGetClient } = trpc.viewer.oAuth.getClient.useQuery(
const { data: client, isPending: isPendingGetClient } = trpc.viewer.oAuth.getClient.useQuery(
{
clientId: client_id as string,
},
@@ -37,7 +37,7 @@ export default function Authorize() {
}
);
const { data, isLoading: isLoadingProfiles } = trpc.viewer.teamsAndUserProfilesQuery.useQuery();
const { data, isPending: isPendingProfiles } = trpc.viewer.teamsAndUserProfilesQuery.useQuery();
const generateAuthCodeMutation = trpc.viewer.oAuth.generateAuthCode.useMutation({
onSuccess: (data) => {
@@ -58,7 +58,7 @@ export default function Authorize() {
if (mappedProfiles.length > 0) {
setSelectedAccount(mappedProfiles[0]);
}
}, [isLoadingProfiles]);
}, [isPendingProfiles]);
useEffect(() => {
if (status === "unauthenticated") {
@@ -69,9 +69,9 @@ export default function Authorize() {
}
}, [status]);
const isLoading = isLoadingGetClient || isLoadingProfiles || status !== "authenticated";
const isPending = isPendingGetClient || isPendingProfiles || status !== "authenticated";
if (isLoading) {
if (isPending) {
return <></>;
}
+9 -9
View File
@@ -41,16 +41,16 @@ export function Setup(props: inferSSRProps<typeof getServerSideProps>) {
{
title: t("administrator_user"),
description: t("lets_create_first_administrator_user"),
content: (setIsLoading) => (
content: (setIsPending) => (
<AdminUser
onSubmit={() => {
setIsLoading(true);
setIsPending(true);
}}
onSuccess={() => {
setStep(2);
}}
onError={() => {
setIsLoading(false);
setIsPending(false);
}}
userCount={props.userCount}
/>
@@ -59,7 +59,7 @@ export function Setup(props: inferSSRProps<typeof getServerSideProps>) {
{
title: t("choose_a_license"),
description: t("choose_license_description"),
content: (setIsLoading) => {
content: (setIsPending) => {
return (
<ChooseLicense
id="wizard-step-2"
@@ -67,7 +67,7 @@ export function Setup(props: inferSSRProps<typeof getServerSideProps>) {
value={value}
onChange={setValue}
onSubmit={() => {
setIsLoading(true);
setIsPending(true);
setStep(3);
}}
/>
@@ -80,14 +80,14 @@ export function Setup(props: inferSSRProps<typeof getServerSideProps>) {
steps.push({
title: t("step_enterprise_license"),
description: t("step_enterprise_license_description"),
content: (setIsLoading) => {
content: (setIsPending) => {
const currentStep = 3;
return (
<EnterpriseLicense
id={`wizard-step-${currentStep}`}
name={`wizard-step-${currentStep}`}
onSubmit={() => {
setIsLoading(true);
setIsPending(true);
}}
onSuccess={() => {
setStep(currentStep + 1);
@@ -106,7 +106,7 @@ export function Setup(props: inferSSRProps<typeof getServerSideProps>) {
title: t("enable_apps"),
description: t("enable_apps_description", { appName: APP_NAME }),
contentClassname: "!pb-0 mb-[-1px]",
content: (setIsLoading) => {
content: (setIsPending) => {
const currentStep = isFreeLicense ? 3 : 4;
return (
<AdminAppsList
@@ -120,7 +120,7 @@ export function Setup(props: inferSSRProps<typeof getServerSideProps>) {
baseURL={`/auth/setup?step=${currentStep}`}
useQueryParam={true}
onSubmit={() => {
setIsLoading(true);
setIsPending(true);
router.replace("/");
}}
/>
+1 -1
View File
@@ -44,7 +44,7 @@ function VerifyEmailPage() {
<Button
color="minimal"
className="underline"
loading={mutation.isLoading}
loading={mutation.isPending}
onClick={() => {
showToast("Send email", "success");
mutation.mutate();
+7 -7
View File
@@ -93,7 +93,7 @@ export default function Availability() {
const fromEventType = searchParams?.get("fromEventType");
const { timeFormat } = me.data || { timeFormat: null };
const [openSidebar, setOpenSidebar] = useState(false);
const { data: schedule, isLoading } = trpc.viewer.availability.schedule.get.useQuery(
const { data: schedule, isPending } = trpc.viewer.availability.schedule.get.useQuery(
{ scheduleId },
{
enabled: !!scheduleId,
@@ -158,7 +158,7 @@ export default function Availability() {
control={form.control}
name="name"
render={({ field }) => (
<EditableHeading isReady={!isLoading} {...field} data-testid="availablity-title" />
<EditableHeading isReady={!isPending} {...field} data-testid="availablity-title" />
)}
/>
}
@@ -188,7 +188,7 @@ export default function Availability() {
</Skeleton>
<Switch
id="hiddenSwitch"
disabled={isLoading || schedule?.isDefault}
disabled={isPending || schedule?.isDefault}
checked={form.watch("isDefault")}
onCheckedChange={(e) => {
form.setValue("isDefault", e);
@@ -210,7 +210,7 @@ export default function Availability() {
/>
</DialogTrigger>
<ConfirmationDialogContent
isLoading={deleteMutation.isLoading}
isPending={deleteMutation.isPending}
variety="danger"
title={t("delete_schedule")}
confirmBtnText={t("delete")}
@@ -249,7 +249,7 @@ export default function Availability() {
/>
</DialogTrigger>
<ConfirmationDialogContent
isLoading={deleteMutation.isLoading}
isPending={deleteMutation.isPending}
variety="danger"
title={t("delete_schedule")}
confirmBtnText={t("delete")}
@@ -284,7 +284,7 @@ export default function Availability() {
</Skeleton>
<Switch
id="hiddenSwitch"
disabled={isLoading || schedule?.isDefault}
disabled={isPending || schedule?.isDefault}
checked={form.watch("isDefault")}
onCheckedChange={(e) => {
form.setValue("isDefault", e);
@@ -334,7 +334,7 @@ export default function Availability() {
className="ml-4 lg:ml-0"
type="submit"
form="availability-form"
loading={updateMutation.isLoading}>
loading={updateMutation.isPending}>
{t("save")}
</Button>
<Button
+13 -11
View File
@@ -15,7 +15,7 @@ import { trpc } from "@calcom/trpc/react";
import { EmptyScreen, showToast, ToggleGroup } from "@calcom/ui";
import { Clock } from "@calcom/ui/components/icon";
import { withQuery } from "@lib/QueryCell";
import { QueryCell } from "@lib/QueryCell";
import PageWrapper from "@components/PageWrapper";
import SkeletonLoader from "@components/availability/SkeletonLoader";
@@ -136,8 +136,17 @@ export function AvailabilityList({ schedules }: RouterOutputs["viewer"]["availab
);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const WithQuery = withQuery(trpc.viewer.availability.list as any);
function AvailabilityListWithQuery() {
const query = trpc.viewer.availability.list.useQuery();
return (
<QueryCell
query={query}
success={({ data }) => <AvailabilityList {...data} />}
customLoader={<SkeletonLoader />}
/>
);
}
export default function AvailabilityPage() {
const { t } = useLocale();
@@ -179,14 +188,7 @@ export default function AvailabilityPage() {
<NewScheduleButton />
</div>
}>
{searchParams?.get("type") === "team" ? (
<AvailabilitySliderTable />
) : (
<WithQuery
success={({ data }) => <AvailabilityList {...data} />}
customLoader={<SkeletonLoader />}
/>
)}
{searchParams?.get("type") === "team" ? <AvailabilitySliderTable /> : <AvailabilityListWithQuery />}
</ShellMain>
</div>
);
+1 -1
View File
@@ -164,7 +164,7 @@ export default function Bookings() {
{query.status === "error" && (
<Alert severity="error" title={t("something_went_wrong")} message={query.error.message} />
)}
{(query.status === "loading" || query.isPaused) && <SkeletonLoader />}
{(query.status === "pending" || query.isPaused) && <SkeletonLoader />}
{query.status === "success" && !isEmpty && (
<>
{!!bookingsToday.length && status === "upcoming" && (
+1 -1
View File
@@ -68,7 +68,7 @@ function ConnectAndJoin() {
</div>
) : (
<Button
loading={mutation.isLoading}
loading={mutation.isPending}
tooltip={isUserPartOfOrg ? t("join_meeting") : t("not_part_of_org")}
disabled={!isUserPartOfOrg}
onClick={() => {
+2 -2
View File
@@ -552,7 +552,7 @@ const EventTypePage = (props: EventTypeSetupProps) => {
eventType={eventType}
team={team}
availability={availability}
isUpdateMutationLoading={updateMutation.isLoading}
isUpdateMutationLoading={updateMutation.isPending}
formMethods={formMethods}
// disableBorder={tabName === "apps" || tabName === "workflows" || tabName === "webhooks"}
disableBorder={true}
@@ -647,7 +647,7 @@ const EventTypePage = (props: EventTypeSetupProps) => {
{slugExistsChildrenDialogOpen.length ? (
<ManagedEventTypeDialog
slugExistsChildrenDialogOpen={slugExistsChildrenDialogOpen}
isLoading={formMethods.formState.isSubmitting}
isPending={formMethods.formState.isSubmitting}
onOpenChange={() => {
setSlugExistsChildrenDialogOpen([]);
}}
+3 -3
View File
@@ -686,7 +686,7 @@ export const EventTypeList = ({
title={t(`delete${isManagedEventPrefix()}_event_type`)}
confirmBtnText={t(`confirm_delete_event_type`)}
loadingText={t(`confirm_delete_event_type`)}
isLoading={deleteMutation.isLoading}
isPending={deleteMutation.isPending}
onConfirm={(e) => {
e.preventDefault();
deleteEventTypeHandler(deleteDialogTypeId);
@@ -856,7 +856,7 @@ const Main = ({
const searchParams = useCompatSearchParams();
const orgBranding = useOrgBranding();
if (!data || status === "loading") {
if (!data || status === "pending") {
return <SkeletonLoader />;
}
@@ -934,7 +934,7 @@ const EventTypesPage = () => {
// TODO: Maybe useSuspenseQuery to focus on success case only? Remember that it would crash the page when there is an error in query. Also, it won't support skeleton
const { data, status, error } = trpc.viewer.eventTypes.getByViewer.useQuery(filters && { filters }, {
refetchOnWindowFocus: false,
cacheTime: 1 * 60 * 60 * 1000,
gcTime: 1 * 60 * 60 * 1000,
staleTime: 1 * 60 * 60 * 1000,
});
@@ -36,7 +36,7 @@ const SkeletonLoader = ({ title, description }: { title: string; description: st
const ApiKeysView = () => {
const { t } = useLocale();
const { data, isLoading } = trpc.viewer.apiKeys.list.useQuery();
const { data, isPending } = trpc.viewer.apiKeys.list.useQuery();
const [apiKeyModal, setApiKeyModal] = useState(false);
const [apiKeyToEdit, setApiKeyToEdit] = useState<(TApiKeys & { neverExpires?: boolean }) | undefined>(
@@ -57,7 +57,7 @@ const ApiKeysView = () => {
);
};
if (isLoading || !data) {
if (isPending || !data) {
return (
<SkeletonLoader
title={t("api_keys")}
@@ -317,7 +317,7 @@ const AppearanceView = ({
<SettingsToggle
toggleSwitchAtTheEnd={true}
title={t("disable_cal_branding", { appName: APP_NAME })}
disabled={!hasPaidPlan || mutation?.isLoading}
disabled={!hasPaidPlan || mutation?.isPending}
description={t("removes_cal_branding", { appName: APP_NAME })}
checked={hasPaidPlan ? hideBrandingValue : false}
Badge={<UpgradeTeamsBadge />}
@@ -332,12 +332,12 @@ const AppearanceView = ({
};
const AppearanceViewWrapper = () => {
const { data: user, isLoading } = trpc.viewer.me.useQuery();
const { isLoading: isTeamPlanStatusLoading, hasPaidPlan } = useHasPaidPlan();
const { data: user, isPending } = trpc.viewer.me.useQuery();
const { isPending: isTeamPlanStatusLoading, hasPaidPlan } = useHasPaidPlan();
const { t } = useLocale();
if (isLoading || isTeamPlanStatusLoading || !user)
if (isPending || isTeamPlanStatusLoading || !user)
return <SkeletonLoader title={t("appearance")} description={t("appearance_description")} />;
return <AppearanceView user={user} hasPaidPlan={hasPaidPlan} />;
@@ -51,8 +51,8 @@ interface GeneralViewProps {
const GeneralQueryView = () => {
const { t } = useLocale();
const { data: user, isLoading } = trpc.viewer.me.useQuery();
if (isLoading) return <SkeletonLoader title={t("general")} description={t("general_description")} />;
const { data: user, isPending } = trpc.viewer.me.useQuery();
if (isPending) return <SkeletonLoader title={t("general")} description={t("general_description")} />;
if (!user) {
throw new Error(t("something_went_wrong"));
}
@@ -233,7 +233,7 @@ const GeneralView = ({ localeProp, user }: GeneralViewProps) => {
toggleSwitchAtTheEnd={true}
title={t("dynamic_booking")}
description={t("allow_dynamic_booking")}
disabled={mutation.isLoading}
disabled={mutation.isPending}
checked={isAllowDynamicBookingChecked}
onCheckedChange={(checked) => {
setIsAllowDynamicBookingChecked(checked);
@@ -246,7 +246,7 @@ const GeneralView = ({ localeProp, user }: GeneralViewProps) => {
toggleSwitchAtTheEnd={true}
title={t("seo_indexing")}
description={t("allow_seo_indexing")}
disabled={mutation.isLoading}
disabled={mutation.isPending}
checked={isAllowSEOIndexingChecked}
onCheckedChange={(checked) => {
setIsAllowSEOIndexingChecked(checked);
@@ -259,7 +259,7 @@ const GeneralView = ({ localeProp, user }: GeneralViewProps) => {
toggleSwitchAtTheEnd={true}
title={t("monthly_digest_email")}
description={t("monthly_digest_email_for_teams")}
disabled={mutation.isLoading}
disabled={mutation.isPending}
checked={isReceiveMonthlyDigestEmailChecked}
onCheckedChange={(checked) => {
setIsReceiveMonthlyDigestEmailChecked(checked);
@@ -155,7 +155,7 @@ const OutOfOfficeSection = () => {
<Button
color="primary"
type="submit"
disabled={createOutOfOfficeEntry.isLoading}
disabled={createOutOfOfficeEntry.isPending}
data-testid="create-entry-ooo-redirect">
{t("create_entry")}
</Button>
@@ -168,7 +168,7 @@ const OutOfOfficeSection = () => {
const OutOfOfficeEntriesList = () => {
const { t } = useLocale();
const utils = trpc.useContext();
const { data, isLoading } = trpc.viewer.outOfOfficeEntriesList.useQuery();
const { data, isPending } = trpc.viewer.outOfOfficeEntriesList.useQuery();
const deleteOutOfOfficeEntryMutation = trpc.viewer.outOfOfficeEntryDelete.useMutation({
onSuccess: () => {
showToast(t("success_deleted_entry_out_of_office"), "success");
@@ -207,7 +207,7 @@ const OutOfOfficeEntriesList = () => {
type="button"
color="minimal"
variant="icon"
disabled={deleteOutOfOfficeEntryMutation.isLoading}
disabled={deleteOutOfOfficeEntryMutation.isPending}
StartIcon={Trash2}
onClick={() => {
deleteOutOfOfficeEntryMutation.mutate({ outOfOfficeUid: item.uuid });
@@ -216,7 +216,7 @@ const OutOfOfficeEntriesList = () => {
</TableCell>
</TableRow>
))}
{isLoading && (
{isPending && (
<TableRow>
{new Array(6).fill(0).map((_, index) => (
<TableCell key={index}>
@@ -226,7 +226,7 @@ const OutOfOfficeEntriesList = () => {
</TableRow>
)}
{!isLoading && (data === undefined || data.length === 0) && (
{!isPending && (data === undefined || data.length === 0) && (
<TableRow>
<TableCell colSpan={6} className="text-center">
<p className="text-subtle text-sm">{t("no_redirects_found")}</p>
@@ -84,10 +84,10 @@ const ProfileView = () => {
const { t } = useLocale();
const utils = trpc.useContext();
const { update } = useSession();
const { data: user, isLoading } = trpc.viewer.me.useQuery();
const { data: user, isPending } = trpc.viewer.me.useQuery();
const { data: avatarData } = trpc.viewer.avatar.useQuery(undefined, {
enabled: !isLoading && !user?.avatarUrl,
enabled: !isPending && !user?.avatarUrl,
});
const updateProfileMutation = trpc.viewer.updateProfile.useMutation({
@@ -222,7 +222,7 @@ const ProfileView = () => {
[ErrorCode.ThirdPartyIdentityProviderEnabled]: t("account_created_with_identity_provider"),
};
if (isLoading || !user) {
if (isPending || !user) {
return (
<SkeletonLoader title={t("profile")} description={t("profile_description", { appName: APP_NAME })} />
);
@@ -246,7 +246,7 @@ const ProfileView = () => {
<ProfileForm
key={JSON.stringify(defaultValues)}
defaultValues={defaultValues}
isLoading={updateProfileMutation.isLoading}
isPending={updateProfileMutation.isPending}
isFallbackImg={!user.avatarUrl && !avatarData?.avatar}
user={user}
userOrganization={user.organization}
@@ -354,7 +354,7 @@ const ProfileView = () => {
<DialogFooter showDivider>
<Button
color="primary"
loading={confirmPasswordMutation.isLoading}
loading={confirmPasswordMutation.isPending}
onClick={(e) => onConfirmPassword(e)}>
{t("confirm")}
</Button>
@@ -375,7 +375,7 @@ const ProfileView = () => {
<DialogFooter>
<Button
color="primary"
loading={updateProfileMutation.isLoading}
loading={updateProfileMutation.isPending}
onClick={(e) => onConfirmAuthEmailChange(e)}>
{t("confirm")}
</Button>
@@ -391,7 +391,7 @@ const ProfileForm = ({
defaultValues,
onSubmit,
extraField,
isLoading = false,
isPending = false,
isFallbackImg,
user,
userOrganization,
@@ -399,7 +399,7 @@ const ProfileForm = ({
defaultValues: FormValues;
onSubmit: (values: FormValues) => void;
extraField?: React.ReactNode;
isLoading: boolean;
isPending: boolean;
isFallbackImg: boolean;
user: RouterOutputs["viewer"]["me"];
userOrganization: RouterOutputs["viewer"]["me"]["organization"];
@@ -509,7 +509,7 @@ const ProfileForm = ({
</div>
</div>
<SectionBottomActions align="end">
<Button loading={isLoading} disabled={isDisabled} color="primary" type="submit">
<Button loading={isPending} disabled={isDisabled} color="primary" type="submit">
{t("update")}
</Button>
</SectionBottomActions>
@@ -69,7 +69,7 @@ const ProfileImpersonationView = ({ user }: { user: RouterOutputs["viewer"]["me"
mutation.mutate({ disableImpersonation: !checked });
}}
switchContainerClassName="rounded-t-none border-t-0"
disabled={mutation.isLoading}
disabled={mutation.isPending}
/>
</div>
</>
@@ -77,10 +77,10 @@ const ProfileImpersonationView = ({ user }: { user: RouterOutputs["viewer"]["me"
};
const ProfileImpersonationViewWrapper = () => {
const { data: user, isLoading } = trpc.viewer.me.useQuery();
const { data: user, isPending } = trpc.viewer.me.useQuery();
const { t } = useLocale();
if (isLoading || !user)
if (isPending || !user)
return <SkeletonLoader title={t("impersonation")} description={t("impersonation_description")} />;
return <ProfileImpersonationView user={user} />;
@@ -215,9 +215,9 @@ const PasswordView = ({ user }: PasswordViewProps) => {
<Button
color="primary"
type="submit"
loading={passwordMutation.isLoading}
loading={passwordMutation.isPending}
onClick={() => formMethods.clearErrors("apiError")}
disabled={isDisabled || passwordMutation.isLoading || sessionMutation.isLoading}>
disabled={isDisabled || passwordMutation.isPending || sessionMutation.isPending}>
{t("update")}
</Button>
</SectionBottomActions>
@@ -268,7 +268,7 @@ const PasswordView = ({ user }: PasswordViewProps) => {
<SectionBottomActions align="end">
<Button
color="primary"
loading={sessionMutation.isLoading}
loading={sessionMutation.isPending}
onClick={() => {
sessionMutation.mutate({
metadata: { ...metadata, sessionTimeout },
@@ -277,8 +277,8 @@ const PasswordView = ({ user }: PasswordViewProps) => {
}}
disabled={
initialSessionTimeout === sessionTimeout ||
passwordMutation.isLoading ||
sessionMutation.isLoading
passwordMutation.isPending ||
sessionMutation.isPending
}>
{t("update")}
</Button>
@@ -293,9 +293,9 @@ const PasswordView = ({ user }: PasswordViewProps) => {
};
const PasswordViewWrapper = () => {
const { data: user, isLoading } = trpc.viewer.me.useQuery();
const { data: user, isPending } = trpc.viewer.me.useQuery();
const { t } = useLocale();
if (isLoading || !user)
if (isPending || !user)
return <SkeletonLoader title={t("password")} description={t("password_description")} />;
return <PasswordView user={user} />;
@@ -37,12 +37,12 @@ const TwoFactorAuthView = () => {
const utils = trpc.useContext();
const { t } = useLocale();
const { data: user, isLoading } = trpc.viewer.me.useQuery();
const { data: user, isPending } = trpc.viewer.me.useQuery();
const [enableModalOpen, setEnableModalOpen] = useState<boolean>(false);
const [disableModalOpen, setDisableModalOpen] = useState<boolean>(false);
if (isLoading)
if (isPending)
return <SkeletonLoader title={t("2fa")} description={t("set_up_two_factor_authentication")} />;
const isCalProvider = user?.identityProvider === "CAL";