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
@@ -82,7 +82,7 @@ const ApiKeyListItem = ({
|
||||
<DropdownItem
|
||||
type="button"
|
||||
color="destructive"
|
||||
disabled={deleteApiKey.isLoading}
|
||||
disabled={deleteApiKey.isPending}
|
||||
onClick={() =>
|
||||
deleteApiKey.mutate({
|
||||
id: apiKey.id,
|
||||
|
||||
@@ -43,7 +43,7 @@ export const AboutOrganizationForm = () => {
|
||||
form={aboutOrganizationFormMethods}
|
||||
className="space-y-5"
|
||||
handleSubmit={(v) => {
|
||||
if (!updateOrganizationMutation.isLoading) {
|
||||
if (!updateOrganizationMutation.isPending) {
|
||||
setServerErrorMessage(null);
|
||||
updateOrganizationMutation.mutate({ ...v, orgId });
|
||||
}
|
||||
@@ -109,7 +109,7 @@ export const AboutOrganizationForm = () => {
|
||||
<div className="flex">
|
||||
<Button
|
||||
disabled={
|
||||
aboutOrganizationFormMethods.formState.isSubmitting || updateOrganizationMutation.isLoading
|
||||
aboutOrganizationFormMethods.formState.isSubmitting || updateOrganizationMutation.isPending
|
||||
}
|
||||
color="primary"
|
||||
EndIcon={ArrowRight}
|
||||
|
||||
@@ -132,7 +132,7 @@ export const AddNewTeamsForm = () => {
|
||||
<Button
|
||||
StartIcon={Plus}
|
||||
color="secondary"
|
||||
disabled={createTeamsMutation.isLoading}
|
||||
disabled={createTeamsMutation.isPending}
|
||||
onClick={handleCounterIncrease}
|
||||
aria-label={t("add_a_team")}
|
||||
className="my-1">
|
||||
@@ -143,7 +143,7 @@ export const AddNewTeamsForm = () => {
|
||||
EndIcon={ArrowRight}
|
||||
color="primary"
|
||||
className="mt-6 w-full justify-center"
|
||||
disabled={!formState.isValid || createTeamsMutation.isLoading || createTeamsMutation.isSuccess}
|
||||
disabled={!formState.isValid || createTeamsMutation.isPending || createTeamsMutation.isSuccess}
|
||||
onClick={handleFormSubmit}>
|
||||
{t("continue")}
|
||||
</Button>
|
||||
|
||||
@@ -80,7 +80,7 @@ export const CreateANewOrganizationForm = ({ slug }: { slug?: string }) => {
|
||||
form={newOrganizationFormMethods}
|
||||
id="createOrg"
|
||||
handleSubmit={(v) => {
|
||||
if (!createOrganizationMutation.isLoading) {
|
||||
if (!createOrganizationMutation.isPending) {
|
||||
setServerErrorMessage(null);
|
||||
createOrganizationMutation.mutate(v);
|
||||
}
|
||||
@@ -188,7 +188,7 @@ export const CreateANewOrganizationForm = ({ slug }: { slug?: string }) => {
|
||||
<div className="flex space-x-2 rtl:space-x-reverse">
|
||||
<Button
|
||||
disabled={
|
||||
newOrganizationFormMethods.formState.isSubmitting || createOrganizationMutation.isLoading
|
||||
newOrganizationFormMethods.formState.isSubmitting || createOrganizationMutation.isPending
|
||||
}
|
||||
color="primary"
|
||||
EndIcon={ArrowRight}
|
||||
|
||||
@@ -61,7 +61,7 @@ export const SetPasswordForm = () => {
|
||||
<Form
|
||||
form={setPasswordFormMethods}
|
||||
handleSubmit={(v) => {
|
||||
if (!setPasswordMutation.isLoading) {
|
||||
if (!setPasswordMutation.isPending) {
|
||||
setServerErrorMessage(null);
|
||||
setPasswordMutation.mutate({ newPassword: v.password });
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export const SetPasswordForm = () => {
|
||||
|
||||
<div className="flex">
|
||||
<Button
|
||||
disabled={setPasswordFormMethods.formState.isSubmitting || setPasswordMutation.isLoading}
|
||||
disabled={setPasswordFormMethods.formState.isSubmitting || setPasswordMutation.isPending}
|
||||
color="primary"
|
||||
EndIcon={ArrowRight}
|
||||
type="submit"
|
||||
|
||||
@@ -44,7 +44,7 @@ export default function OtherTeamList(props: Props) {
|
||||
key={team?.id as number}
|
||||
team={team}
|
||||
onActionSelect={(action: string) => selectAction(action, team?.id as number)}
|
||||
isLoading={deleteTeamMutation.isLoading}
|
||||
isPending={deleteTeamMutation.isPending}
|
||||
hideDropdown={hideDropdown}
|
||||
setHideDropdown={setHideDropdown}
|
||||
/>
|
||||
|
||||
@@ -24,7 +24,7 @@ interface Props {
|
||||
team: RouterOutputs["viewer"]["organizations"]["listOtherTeams"][number];
|
||||
key: number;
|
||||
onActionSelect: (text: string) => void;
|
||||
isLoading?: boolean;
|
||||
isPending?: boolean;
|
||||
hideDropdown: boolean;
|
||||
setHideDropdown: (value: boolean) => void;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ export default function OtherTeamListItem(props: Props) {
|
||||
variety="danger"
|
||||
title={t("disband_team")}
|
||||
confirmBtnText={t("confirm_disband_team")}
|
||||
isLoading={props.isLoading}
|
||||
isPending={props.isPending}
|
||||
onConfirm={() => {
|
||||
props.onActionSelect("disband");
|
||||
}}>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import SkeletonLoaderTeamList from "@calcom/ee/teams/components/SkeletonloaderTeamList";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
@@ -10,21 +8,15 @@ import OtherTeamList from "./OtherTeamList";
|
||||
export function OtherTeamsListing() {
|
||||
const { t } = useLocale();
|
||||
|
||||
const [errorMessage, setErrorMessage] = useState("");
|
||||
const { data: teams, isPending, error } = trpc.viewer.organizations.listOtherTeams.useQuery();
|
||||
|
||||
const { data: teams, isLoading } = trpc.viewer.organizations.listOtherTeams.useQuery(undefined, {
|
||||
onError: (e) => {
|
||||
setErrorMessage(e.message);
|
||||
},
|
||||
});
|
||||
|
||||
if (isLoading) {
|
||||
if (isPending) {
|
||||
return <SkeletonLoaderTeamList />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{!!errorMessage && <Alert severity="error" title={errorMessage} />}
|
||||
{!!error && <Alert severity="error" title={error.message} />}
|
||||
|
||||
{teams && teams.length > 0 ? (
|
||||
<OtherTeamList teams={teams} />
|
||||
|
||||
@@ -98,7 +98,7 @@ const OrgForm = ({
|
||||
required
|
||||
{...form.register("metadata.orgAutoAcceptEmail")}
|
||||
/>
|
||||
<Button type="submit" color="primary" loading={mutation.isLoading}>
|
||||
<Button type="submit" color="primary" loading={mutation.isPending}>
|
||||
{t("save")}
|
||||
</Button>
|
||||
</Form>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
|
||||
@@ -107,7 +107,7 @@ const OrgAppearanceView = ({
|
||||
calVideoLogo: newLogo,
|
||||
});
|
||||
}}
|
||||
disabled={mutation.isLoading}
|
||||
disabled={mutation.isPending}
|
||||
imageSrc={currentOrg?.calVideoLogo ?? undefined}
|
||||
uploadInstruction={t("cal_video_logo_upload_instruction")}
|
||||
triggerButtonColor={currentOrg?.calVideoLogo ? "secondary" : "primary"}
|
||||
@@ -115,7 +115,7 @@ const OrgAppearanceView = ({
|
||||
{currentOrg?.calVideoLogo && (
|
||||
<Button
|
||||
color="destructive"
|
||||
disabled={mutation.isLoading}
|
||||
disabled={mutation.isPending}
|
||||
onClick={() => {
|
||||
mutation.mutate({
|
||||
calVideoLogo: null,
|
||||
@@ -190,7 +190,7 @@ const OrgAppearanceView = ({
|
||||
<SettingsToggle
|
||||
toggleSwitchAtTheEnd={true}
|
||||
title={t("disable_cal_branding", { appName: APP_NAME })}
|
||||
disabled={mutation?.isLoading}
|
||||
disabled={mutation?.isPending}
|
||||
description={t("removes_cal_branding", { appName: APP_NAME })}
|
||||
checked={hideBrandingValue}
|
||||
onCheckedChange={(checked) => {
|
||||
@@ -212,13 +212,18 @@ const OrgAppearanceView = ({
|
||||
const OrgAppearanceViewWrapper = () => {
|
||||
const router = useRouter();
|
||||
const { t } = useLocale();
|
||||
const { data: currentOrg, isLoading } = trpc.viewer.organizations.listCurrent.useQuery(undefined, {
|
||||
onError: () => {
|
||||
router.push("/settings");
|
||||
},
|
||||
});
|
||||
const { data: currentOrg, isPending, error } = trpc.viewer.organizations.listCurrent.useQuery();
|
||||
|
||||
if (isLoading) {
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
if (error) {
|
||||
router.push("/settings");
|
||||
}
|
||||
},
|
||||
[error]
|
||||
);
|
||||
|
||||
if (isPending) {
|
||||
return <AppearanceSkeletonLoader title={t("appearance")} description={t("appearance_org_description")} />;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect } from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
|
||||
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
|
||||
@@ -50,14 +51,23 @@ const OrgGeneralView = () => {
|
||||
const { t } = useLocale();
|
||||
const router = useRouter();
|
||||
|
||||
const { data: currentOrg, isLoading } = trpc.viewer.organizations.listCurrent.useQuery(undefined, {
|
||||
onError: () => {
|
||||
router.push("/settings");
|
||||
},
|
||||
});
|
||||
const {
|
||||
data: currentOrg,
|
||||
isPending,
|
||||
error,
|
||||
} = trpc.viewer.organizations.listCurrent.useQuery(undefined, {});
|
||||
const { data: user } = trpc.viewer.me.useQuery();
|
||||
|
||||
if (isLoading) return <SkeletonLoader title={t("general")} description={t("general_description")} />;
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
if (error) {
|
||||
router.push("/settings");
|
||||
}
|
||||
},
|
||||
[error]
|
||||
);
|
||||
|
||||
if (isPending) return <SkeletonLoader title={t("general")} description={t("general_description")} />;
|
||||
if (!currentOrg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
"use client";
|
||||
|
||||
// import { debounce } from "lodash";
|
||||
import { keepPreviousData } from "@tanstack/react-query";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import MemberInvitationModal from "@calcom/ee/teams/components/MemberInvitationModal";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
@@ -71,20 +72,21 @@ const MembersView = () => {
|
||||
// const [queryToFetch, setQueryToFetch] = useState<string | undefined>("");
|
||||
const limit = 20;
|
||||
const [showMemberInvitationModal, setShowMemberInvitationModal] = useState<boolean>(false);
|
||||
const [members, setMembers] = useState<Members>([]);
|
||||
|
||||
const { data: currentOrg } = trpc.viewer.organizations.listCurrent.useQuery(undefined, {
|
||||
enabled: !!session.data?.user?.org,
|
||||
});
|
||||
const { data: team, isLoading: isTeamLoading } = trpc.viewer.organizations.getOtherTeam.useQuery(
|
||||
const {
|
||||
data: team,
|
||||
isPending: isTeamLoading,
|
||||
error: otherTeamError,
|
||||
} = trpc.viewer.organizations.getOtherTeam.useQuery(
|
||||
{ teamId },
|
||||
{
|
||||
enabled: !Number.isNaN(teamId),
|
||||
onError: () => {
|
||||
router.push("/settings");
|
||||
},
|
||||
}
|
||||
);
|
||||
const { data: orgMembersNotInThisTeam, isLoading: isOrgListLoading } =
|
||||
const { data: orgMembersNotInThisTeam, isPending: isOrgListLoading } =
|
||||
trpc.viewer.organizations.getMembers.useQuery(
|
||||
{
|
||||
teamIdToExclude: teamId,
|
||||
@@ -95,24 +97,40 @@ const MembersView = () => {
|
||||
}
|
||||
);
|
||||
|
||||
const { fetchNextPage, isFetchingNextPage, hasNextPage } =
|
||||
trpc.viewer.organizations.listOtherTeamMembers.useInfiniteQuery(
|
||||
{ teamId, limit },
|
||||
{
|
||||
onSuccess: (data) => {
|
||||
const flatData = data?.pages?.flatMap((page) => page.rows) as Members;
|
||||
setMembers(flatData);
|
||||
},
|
||||
enabled: !Number.isNaN(teamId),
|
||||
onError: () => {
|
||||
router.push("/settings");
|
||||
},
|
||||
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
||||
keepPreviousData: true,
|
||||
}
|
||||
);
|
||||
const {
|
||||
fetchNextPage,
|
||||
isFetchingNextPage,
|
||||
hasNextPage,
|
||||
error: otherMembersError,
|
||||
data,
|
||||
} = trpc.viewer.organizations.listOtherTeamMembers.useInfiniteQuery(
|
||||
{ teamId, limit },
|
||||
{
|
||||
enabled: !Number.isNaN(teamId),
|
||||
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
||||
placeholderData: keepPreviousData,
|
||||
}
|
||||
);
|
||||
|
||||
const isLoading = isTeamLoading || isOrgListLoading;
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
if (otherMembersError || otherTeamError) {
|
||||
router.push("/settings");
|
||||
}
|
||||
},
|
||||
[otherMembersError, otherTeamError]
|
||||
);
|
||||
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
if (data) {
|
||||
router.push("/settings");
|
||||
}
|
||||
},
|
||||
[data]
|
||||
);
|
||||
|
||||
const isPending = isTeamLoading || isOrgListLoading;
|
||||
const inviteMemberMutation = trpc.viewer.teams.inviteMember.useMutation({
|
||||
onSuccess: () => {
|
||||
utils.viewer.organizations.getMembers.invalidate();
|
||||
@@ -147,7 +165,7 @@ const MembersView = () => {
|
||||
)
|
||||
}
|
||||
/>
|
||||
{!isLoading && (
|
||||
{!isPending && (
|
||||
<>
|
||||
<div>
|
||||
<>
|
||||
@@ -163,7 +181,7 @@ const MembersView = () => {
|
||||
placeholder={`${t("search")}...`}
|
||||
/> */}
|
||||
<MembersList
|
||||
members={members}
|
||||
members={data?.pages?.flatMap((page) => page.rows) ?? []}
|
||||
team={team}
|
||||
fetchNextPage={fetchNextPage}
|
||||
hasNextPage={hasNextPage}
|
||||
@@ -180,7 +198,7 @@ const MembersView = () => {
|
||||
</div>
|
||||
{showMemberInvitationModal && team && (
|
||||
<MemberInvitationModal
|
||||
isLoading={inviteMemberMutation.isLoading}
|
||||
isPending={inviteMemberMutation.isPending}
|
||||
isOpen={showMemberInvitationModal}
|
||||
orgMembers={orgMembersNotInThisTeam}
|
||||
teamId={team.id}
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { Prisma } from "@prisma/client";
|
||||
import { useSession } from "next-auth/react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState, useLayoutEffect } from "react";
|
||||
import { useState, useLayoutEffect, useEffect } from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -18,7 +18,6 @@ import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
|
||||
import objectKeys from "@calcom/lib/objectKeys";
|
||||
import slugify from "@calcom/lib/slugify";
|
||||
import turndown from "@calcom/lib/turndownService";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { SkeletonContainer, SkeletonText } from "@calcom/ui";
|
||||
import {
|
||||
@@ -81,26 +80,39 @@ const OtherTeamProfileView = () => {
|
||||
});
|
||||
const params = useParamsWithFallback();
|
||||
const teamId = Number(params.id);
|
||||
const { data: team, isLoading } = trpc.viewer.organizations.getOtherTeam.useQuery(
|
||||
const {
|
||||
data: team,
|
||||
isPending,
|
||||
error: teamError,
|
||||
} = trpc.viewer.organizations.getOtherTeam.useQuery(
|
||||
{ teamId: teamId },
|
||||
{
|
||||
enabled: !Number.isNaN(teamId),
|
||||
onError: () => {
|
||||
router.push("/settings");
|
||||
},
|
||||
onSuccess: (team: RouterOutputs["viewer"]["organizations"]["getOtherTeam"]) => {
|
||||
if (team) {
|
||||
form.setValue("name", team.name || "");
|
||||
form.setValue("slug", team.slug || "");
|
||||
form.setValue("logo", team.logo || "");
|
||||
form.setValue("bio", team.bio || "");
|
||||
if (team.slug === null && (team?.metadata as Prisma.JsonObject)?.requestedSlug) {
|
||||
form.setValue("slug", ((team?.metadata as Prisma.JsonObject)?.requestedSlug as string) || "");
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
if (teamError) {
|
||||
router.push("/settings");
|
||||
}
|
||||
},
|
||||
[teamError]
|
||||
);
|
||||
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
if (team) {
|
||||
form.setValue("name", team.name || "");
|
||||
form.setValue("slug", team.slug || "");
|
||||
form.setValue("logo", team.logo || "");
|
||||
form.setValue("bio", team.bio || "");
|
||||
if (team.slug === null && (team?.metadata as Prisma.JsonObject)?.requestedSlug) {
|
||||
form.setValue("slug", ((team?.metadata as Prisma.JsonObject)?.requestedSlug as string) || "");
|
||||
}
|
||||
}
|
||||
},
|
||||
[team]
|
||||
);
|
||||
|
||||
// This page can only be accessed by team admins (owner/admin)
|
||||
const isAdmin = true;
|
||||
@@ -157,7 +169,7 @@ const OtherTeamProfileView = () => {
|
||||
return (
|
||||
<>
|
||||
<Meta title={t("profile")} description={t("profile_team_description")} />
|
||||
{!isLoading ? (
|
||||
{!isPending ? (
|
||||
<>
|
||||
{isAdmin ? (
|
||||
<Form
|
||||
@@ -249,7 +261,7 @@ const OtherTeamProfileView = () => {
|
||||
/>
|
||||
</div>
|
||||
<p className="text-default mt-2 text-sm">{t("team_description")}</p>
|
||||
<Button color="primary" className="mt-8" type="submit" loading={mutation.isLoading}>
|
||||
<Button color="primary" className="mt-8" type="submit" loading={mutation.isPending}>
|
||||
{t("update")}
|
||||
</Button>
|
||||
{IS_TEAM_BILLING_ENABLED &&
|
||||
|
||||
@@ -4,7 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import type { Prisma } from "@prisma/client";
|
||||
import { LinkIcon } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState, useLayoutEffect } from "react";
|
||||
import { useState, useLayoutEffect, useEffect } from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -79,13 +79,22 @@ const OrgProfileView = () => {
|
||||
document.body.focus();
|
||||
}, []);
|
||||
|
||||
const { data: currentOrganisation, isLoading } = trpc.viewer.organizations.listCurrent.useQuery(undefined, {
|
||||
onError: () => {
|
||||
router.push("/settings");
|
||||
},
|
||||
});
|
||||
const {
|
||||
data: currentOrganisation,
|
||||
isPending,
|
||||
error,
|
||||
} = trpc.viewer.organizations.listCurrent.useQuery(undefined, {});
|
||||
|
||||
if (isLoading || !orgBranding || !currentOrganisation) {
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
if (error) {
|
||||
router.push("/settings");
|
||||
}
|
||||
},
|
||||
[error]
|
||||
);
|
||||
|
||||
if (isPending || !orgBranding || !currentOrganisation) {
|
||||
return <SkeletonLoader title={t("profile")} description={t("profile_org_description")} />;
|
||||
}
|
||||
|
||||
@@ -286,7 +295,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
<p className="text-default mt-2 text-sm">{t("org_description")}</p>
|
||||
</div>
|
||||
<SectionBottomActions align="end">
|
||||
<Button color="primary" type="submit" loading={mutation.isLoading} disabled={isDisabled}>
|
||||
<Button color="primary" type="submit" loading={mutation.isPending} disabled={isDisabled}>
|
||||
{t("update")}
|
||||
</Button>
|
||||
</SectionBottomActions>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import ConnectionInfo from "@calcom/ee/sso/components/ConnectionInfo";
|
||||
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
|
||||
import OIDCConnection from "@calcom/features/ee/sso/components/OIDCConnection";
|
||||
@@ -22,23 +20,15 @@ const SkeletonLoader = ({ title, description }: { title: string; description: st
|
||||
};
|
||||
|
||||
export default function SSOConfiguration({ teamId }: { teamId: number | null }) {
|
||||
const [errorMessage, setErrorMessage] = useState("");
|
||||
const { t } = useLocale();
|
||||
|
||||
const { data: connection, isLoading } = trpc.viewer.saml.get.useQuery(
|
||||
{ teamId },
|
||||
{
|
||||
onError: (err) => {
|
||||
setErrorMessage(err.message);
|
||||
},
|
||||
}
|
||||
);
|
||||
const { data: connection, isPending, error } = trpc.viewer.saml.get.useQuery({ teamId });
|
||||
|
||||
if (isLoading) {
|
||||
if (isPending) {
|
||||
return <SkeletonLoader title={t("sso_configuration")} description={t("sso_configuration_description")} />;
|
||||
}
|
||||
|
||||
if (errorMessage) {
|
||||
if (error) {
|
||||
return (
|
||||
<>
|
||||
<Meta
|
||||
@@ -46,7 +36,7 @@ export default function SSOConfiguration({ teamId }: { teamId: number | null })
|
||||
description={t("sso_configuration_description")}
|
||||
borderInShellHeader={true}
|
||||
/>
|
||||
<Alert severity="warning" message={t(errorMessage)} className="mt-4" />
|
||||
<Alert severity="warning" message={t(error.message)} className="mt-4" />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,14 +19,7 @@ const SAMLSSO = () => {
|
||||
|
||||
const teamId = Number(params.id);
|
||||
|
||||
const { data: team, isLoading } = trpc.viewer.teams.get.useQuery(
|
||||
{ teamId },
|
||||
{
|
||||
onError: () => {
|
||||
router.push("/settings");
|
||||
},
|
||||
}
|
||||
);
|
||||
const { data: team, isPending, error } = trpc.viewer.teams.get.useQuery({ teamId });
|
||||
|
||||
useEffect(() => {
|
||||
if (!HOSTED_CAL_FEATURES) {
|
||||
@@ -34,7 +27,15 @@ const SAMLSSO = () => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
if (isLoading) {
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
if (error) {
|
||||
router.push("/settings");
|
||||
}
|
||||
},
|
||||
[error]
|
||||
);
|
||||
if (isPending) {
|
||||
return <SkeletonLoader />;
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ export default function HelpMenuItem({ onHelpItemSelect }: HelpMenuItemProps) {
|
||||
<div className="my-2 flex justify-end">
|
||||
<Button
|
||||
disabled={disableSubmit}
|
||||
loading={mutation.isLoading}
|
||||
loading={mutation.isPending}
|
||||
onClick={async () => {
|
||||
if (rating && comment) {
|
||||
await sendFeedback(rating, comment);
|
||||
|
||||
@@ -79,7 +79,7 @@ export const AddNewTeamMembersForm = ({
|
||||
const [memberInviteModal, setMemberInviteModal] = useState(showDialog);
|
||||
const [inviteLinkSettingsModal, setInviteLinkSettingsModal] = useState(false);
|
||||
|
||||
const { data: team, isLoading } = trpc.viewer.teams.get.useQuery({ teamId, isOrg }, { enabled: !!teamId });
|
||||
const { data: team, isPending } = trpc.viewer.teams.get.useQuery({ teamId, isOrg }, { enabled: !!teamId });
|
||||
const { data: orgMembersNotInThisTeam } = trpc.viewer.organizations.getMembers.useQuery(
|
||||
{
|
||||
teamIdToExclude: teamId,
|
||||
@@ -126,12 +126,12 @@ export const AddNewTeamMembersForm = ({
|
||||
{isOrg ? t("add_org_members") : t("add_team_member")}
|
||||
</Button>
|
||||
</div>
|
||||
{isLoading ? (
|
||||
{isPending ? (
|
||||
<SkeletonButton />
|
||||
) : (
|
||||
<>
|
||||
<MemberInvitationModal
|
||||
isLoading={inviteMemberMutation.isLoading}
|
||||
isPending={inviteMemberMutation.isPending}
|
||||
isOpen={memberInviteModal}
|
||||
orgMembers={orgMembersNotInThisTeam}
|
||||
teamId={teamId}
|
||||
@@ -199,7 +199,7 @@ export const AddNewTeamMembersForm = ({
|
||||
EndIcon={!orgBranding || isOrg ? ArrowRight : undefined}
|
||||
color="primary"
|
||||
className="w-full justify-center"
|
||||
disabled={publishTeamMutation.isLoading}
|
||||
disabled={publishTeamMutation.isPending}
|
||||
onClick={() => {
|
||||
let uri = `/settings/teams/${teamId}/profile`;
|
||||
if (isOrg) {
|
||||
|
||||
@@ -71,7 +71,7 @@ export const CreateANewTeamForm = () => {
|
||||
<Form
|
||||
form={newTeamFormMethods}
|
||||
handleSubmit={(v) => {
|
||||
if (!createTeamMutation.isLoading) {
|
||||
if (!createTeamMutation.isPending) {
|
||||
setServerErrorMessage(null);
|
||||
createTeamMutation.mutate(v);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ export const CreateANewTeamForm = () => {
|
||||
<TextField
|
||||
disabled={
|
||||
/* E2e is too fast and it tries to fill this way before the form is ready */
|
||||
!isLocaleReady || createTeamMutation.isLoading
|
||||
!isLocaleReady || createTeamMutation.isPending
|
||||
}
|
||||
className="mt-2"
|
||||
placeholder="Acme Inc."
|
||||
@@ -146,14 +146,14 @@ export const CreateANewTeamForm = () => {
|
||||
|
||||
<div className="flex space-x-2 rtl:space-x-reverse">
|
||||
<Button
|
||||
disabled={createTeamMutation.isLoading}
|
||||
disabled={createTeamMutation.isPending}
|
||||
color="secondary"
|
||||
href={returnToParam}
|
||||
className="w-full justify-center">
|
||||
{t("cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
disabled={newTeamFormMethods.formState.isSubmitting || createTeamMutation.isLoading}
|
||||
disabled={newTeamFormMethods.formState.isSubmitting || createTeamMutation.isPending}
|
||||
color="primary"
|
||||
EndIcon={ArrowRight}
|
||||
type="submit"
|
||||
|
||||
@@ -26,14 +26,14 @@ const DisableTeamImpersonation = ({
|
||||
},
|
||||
});
|
||||
const [allowImpersonation, setAllowImpersonation] = useState(!query.data?.disableImpersonation ?? true);
|
||||
if (query.isLoading) return <></>;
|
||||
if (query.isPending) return <></>;
|
||||
|
||||
return (
|
||||
<>
|
||||
<SettingsToggle
|
||||
toggleSwitchAtTheEnd={true}
|
||||
title={t("user_impersonation_heading")}
|
||||
disabled={disabled || mutation?.isLoading}
|
||||
disabled={disabled || mutation?.isPending}
|
||||
description={t("team_impersonation_description")}
|
||||
checked={allowImpersonation}
|
||||
onCheckedChange={(_allowImpersonation) => {
|
||||
|
||||
@@ -76,14 +76,14 @@ export function GoogleWorkspaceInviteButton(
|
||||
}}
|
||||
className="w-full justify-center gap-2"
|
||||
StartIcon={UsersIcon}
|
||||
loading={mutation.isLoading}>
|
||||
loading={mutation.isPending}>
|
||||
{t("import_from_google_workspace")}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip content="Remove workspace connection">
|
||||
<Button
|
||||
color="secondary"
|
||||
loading={removeConnectionMutation.isLoading}
|
||||
loading={removeConnectionMutation.isPending}
|
||||
StartIcon={XIcon}
|
||||
onClick={() => {
|
||||
removeConnectionMutation.mutate();
|
||||
|
||||
@@ -34,7 +34,7 @@ const MakeTeamPrivateSwitch = ({
|
||||
<SettingsToggle
|
||||
toggleSwitchAtTheEnd={true}
|
||||
title={t("make_team_private")}
|
||||
disabled={disabled || mutation?.isLoading}
|
||||
disabled={disabled || mutation?.isPending}
|
||||
description={t("make_team_private_description")}
|
||||
checked={isTeamPrivate}
|
||||
onCheckedChange={(checked) => {
|
||||
|
||||
@@ -41,7 +41,7 @@ type MemberInvitationModalProps = {
|
||||
teamId: number;
|
||||
members?: PendingMember[];
|
||||
token?: string;
|
||||
isLoading?: boolean;
|
||||
isPending?: boolean;
|
||||
disableCopyLink?: boolean;
|
||||
isOrg?: boolean;
|
||||
};
|
||||
@@ -428,7 +428,7 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
|
||||
{t("cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
loading={props.isLoading || createInviteMutation.isLoading}
|
||||
loading={props.isPending || createInviteMutation.isPending}
|
||||
type="submit"
|
||||
color="primary"
|
||||
className="me-2 ms-2"
|
||||
|
||||
@@ -22,7 +22,7 @@ interface Props {
|
||||
export default function TeamAvailabilityTimes(props: Props) {
|
||||
const { t } = useLocale();
|
||||
|
||||
const { data, isLoading } = trpc.viewer.teams.getMemberAvailability.useQuery(
|
||||
const { data, isPending } = trpc.viewer.teams.getMemberAvailability.useQuery(
|
||||
{
|
||||
teamId: props.teamId,
|
||||
memberId: props.memberId,
|
||||
@@ -35,7 +35,7 @@ export default function TeamAvailabilityTimes(props: Props) {
|
||||
}
|
||||
);
|
||||
|
||||
const slots = !isLoading
|
||||
const slots = !isPending
|
||||
? getSlots({
|
||||
frequency: props.frequency,
|
||||
inviteeDate: props.selectedDate,
|
||||
@@ -50,13 +50,13 @@ export default function TeamAvailabilityTimes(props: Props) {
|
||||
return (
|
||||
<div className={classNames("min-w-60 flex-grow pl-0", props.className)}>
|
||||
{props.HeaderComponent}
|
||||
{isLoading && slots.length === 0 && <SkeletonLoader />}
|
||||
{!isLoading && slots.length === 0 ? (
|
||||
{isPending && slots.length === 0 && <SkeletonLoader />}
|
||||
{!isPending && slots.length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center pt-4">
|
||||
<span className="text-subtle text-sm">{t("no_available_slots")}</span>
|
||||
</div>
|
||||
) : (
|
||||
<>{!isLoading && <p className="text-default mb-3 text-sm">{t("time_available")}</p>}</>
|
||||
<>{!isPending && <p className="text-default mb-3 text-sm">{t("time_available")}</p>}</>
|
||||
)}
|
||||
<div className="max-h-[390px] overflow-scroll">
|
||||
{slots.map((slot) => (
|
||||
|
||||
@@ -54,7 +54,7 @@ export default function TeamInviteList(props: Props) {
|
||||
key={team?.id as number}
|
||||
team={team}
|
||||
onActionSelect={(action: string) => selectAction(action, team?.id as number)}
|
||||
isLoading={deleteTeamMutation.isLoading}
|
||||
isPending={deleteTeamMutation.isPending}
|
||||
hideDropdown={hideDropdown}
|
||||
setHideDropdown={setHideDropdown}
|
||||
/>
|
||||
|
||||
@@ -27,7 +27,7 @@ interface Props {
|
||||
};
|
||||
key: number;
|
||||
onActionSelect: (text: string) => void;
|
||||
isLoading?: boolean;
|
||||
isPending?: boolean;
|
||||
hideDropdown: boolean;
|
||||
setHideDropdown: (value: boolean) => void;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export default function TeamList(props: Props) {
|
||||
key={team?.id as number}
|
||||
team={team}
|
||||
onActionSelect={(action: string) => selectAction(action, team?.id as number)}
|
||||
isLoading={deleteTeamMutation.isLoading}
|
||||
isPending={deleteTeamMutation.isPending}
|
||||
hideDropdown={hideDropdown}
|
||||
setHideDropdown={setHideDropdown}
|
||||
/>
|
||||
|
||||
@@ -49,7 +49,7 @@ interface Props {
|
||||
team: RouterOutputs["viewer"]["teams"]["list"][number];
|
||||
key: number;
|
||||
onActionSelect: (text: string) => void;
|
||||
isLoading?: boolean;
|
||||
isPending?: boolean;
|
||||
hideDropdown: boolean;
|
||||
setHideDropdown: (value: boolean) => void;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ export default function TeamListItem(props: Props) {
|
||||
onExit={() => {
|
||||
setOpenMemberInvitationModal(false);
|
||||
}}
|
||||
isLoading={inviteMemberMutation.isLoading}
|
||||
isPending={inviteMemberMutation.isPending}
|
||||
onSubmit={(values, resetFields) => {
|
||||
inviteMemberMutation.mutate(
|
||||
{
|
||||
@@ -322,7 +322,7 @@ export default function TeamListItem(props: Props) {
|
||||
variety="danger"
|
||||
title={t("disband_team")}
|
||||
confirmBtnText={t("confirm_disband_team")}
|
||||
isLoading={props.isLoading}
|
||||
isPending={props.isPending}
|
||||
onConfirm={() => {
|
||||
props.onActionSelect("disband");
|
||||
}}>
|
||||
|
||||
@@ -20,13 +20,9 @@ export function TeamsListing() {
|
||||
const router = useRouter();
|
||||
|
||||
const [inviteTokenChecked, setInviteTokenChecked] = useState(false);
|
||||
const [errorMessage, setErrorMessage] = useState("");
|
||||
|
||||
const { data, isLoading } = trpc.viewer.teams.list.useQuery(undefined, {
|
||||
const { data, isPending, error } = trpc.viewer.teams.list.useQuery(undefined, {
|
||||
enabled: inviteTokenChecked,
|
||||
onError: (e) => {
|
||||
setErrorMessage(e.message);
|
||||
},
|
||||
});
|
||||
|
||||
const { data: user } = trpc.viewer.me.useQuery();
|
||||
@@ -88,13 +84,13 @@ export function TeamsListing() {
|
||||
else setInviteTokenChecked(true);
|
||||
}, [router, inviteMemberByToken, setInviteTokenChecked, token]);
|
||||
|
||||
if (isLoading || !inviteTokenChecked) {
|
||||
if (isPending || !inviteTokenChecked) {
|
||||
return <SkeletonLoaderTeamList />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{!!errorMessage && <Alert severity="error" title={errorMessage} />}
|
||||
{!!error && <Alert severity="error" title={error.message} />}
|
||||
|
||||
{invites.length > 0 && (
|
||||
<div className="bg-subtle mb-6 rounded-md p-5">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
import BrandColorsForm from "@calcom/features/ee/components/BrandColorsForm";
|
||||
@@ -151,7 +151,7 @@ const ProfileView = ({ team }: ProfileViewProps) => {
|
||||
<SettingsToggle
|
||||
toggleSwitchAtTheEnd={true}
|
||||
title={t("disable_cal_branding", { appName: APP_NAME })}
|
||||
disabled={mutation?.isLoading}
|
||||
disabled={mutation?.isPending}
|
||||
description={t("removes_cal_branding", { appName: APP_NAME })}
|
||||
checked={hideBrandingValue}
|
||||
onCheckedChange={(checked) => {
|
||||
@@ -163,7 +163,7 @@ const ProfileView = ({ team }: ProfileViewProps) => {
|
||||
<SettingsToggle
|
||||
toggleSwitchAtTheEnd={true}
|
||||
title={t("hide_book_a_team_member")}
|
||||
disabled={mutation?.isLoading}
|
||||
disabled={mutation?.isPending}
|
||||
description={t("hide_book_a_team_member_description", { appName: APP_NAME })}
|
||||
checked={hideBookATeamMember ?? false}
|
||||
onCheckedChange={(checked) => {
|
||||
@@ -188,16 +188,18 @@ const ProfileViewWrapper = () => {
|
||||
|
||||
const { t } = useLocale();
|
||||
|
||||
const { data: team, isLoading } = trpc.viewer.teams.get.useQuery(
|
||||
{ teamId: Number(params.id) },
|
||||
{
|
||||
onError: () => {
|
||||
const { data: team, isPending, error } = trpc.viewer.teams.get.useQuery({ teamId: Number(params.id) });
|
||||
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
if (error) {
|
||||
router.push("/settings");
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
[error]
|
||||
);
|
||||
|
||||
if (isLoading)
|
||||
if (isPending)
|
||||
return (
|
||||
<AppearanceSkeletonLoader title={t("appearance")} description={t("appearance_team_description")} />
|
||||
);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
@@ -94,7 +94,7 @@ const MembersView = () => {
|
||||
enabled: !!session.data?.user?.org,
|
||||
});
|
||||
|
||||
const { data: orgMembersNotInThisTeam, isLoading: isOrgListLoading } =
|
||||
const { data: orgMembersNotInThisTeam, isPending: isOrgListLoading } =
|
||||
trpc.viewer.organizations.getMembers.useQuery(
|
||||
{
|
||||
teamIdToExclude: teamId,
|
||||
@@ -105,17 +105,26 @@ const MembersView = () => {
|
||||
}
|
||||
);
|
||||
|
||||
const { data: team, isLoading: isTeamsLoading } = trpc.viewer.teams.get.useQuery(
|
||||
const {
|
||||
data: team,
|
||||
isPending: isTeamsLoading,
|
||||
error: teamError,
|
||||
} = trpc.viewer.teams.get.useQuery(
|
||||
{ teamId },
|
||||
{
|
||||
enabled: !!teamId,
|
||||
onError: () => {
|
||||
router.push("/settings");
|
||||
},
|
||||
}
|
||||
);
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
if (teamError) {
|
||||
router.push("/settings");
|
||||
}
|
||||
},
|
||||
[teamError]
|
||||
);
|
||||
|
||||
const isLoading = isOrgListLoading || isTeamsLoading;
|
||||
const isPending = isOrgListLoading || isTeamsLoading;
|
||||
|
||||
const inviteMemberMutation = trpc.viewer.teams.inviteMember.useMutation();
|
||||
|
||||
@@ -149,7 +158,7 @@ const MembersView = () => {
|
||||
)
|
||||
}
|
||||
/>
|
||||
{!isLoading && (
|
||||
{!isPending && (
|
||||
<>
|
||||
<div>
|
||||
{team && (
|
||||
@@ -190,7 +199,7 @@ const MembersView = () => {
|
||||
</div>
|
||||
{showMemberInvitationModal && team && (
|
||||
<MemberInvitationModal
|
||||
isLoading={inviteMemberMutation.isLoading}
|
||||
isPending={inviteMemberMutation.isPending}
|
||||
isOpen={showMemberInvitationModal}
|
||||
orgMembers={orgMembersNotInThisTeam}
|
||||
members={team.members}
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { Prisma } from "@prisma/client";
|
||||
import { useSession } from "next-auth/react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useLayoutEffect, useState } from "react";
|
||||
import { useLayoutEffect, useState, useEffect } from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -93,16 +93,25 @@ const ProfileView = () => {
|
||||
document.body.focus();
|
||||
}, []);
|
||||
|
||||
const { data: team, isLoading } = trpc.viewer.teams.get.useQuery(
|
||||
const {
|
||||
data: team,
|
||||
isPending,
|
||||
error,
|
||||
} = trpc.viewer.teams.get.useQuery(
|
||||
{ teamId, includeTeamLogo: true },
|
||||
{
|
||||
enabled: !!teamId,
|
||||
onError: () => {
|
||||
router.push("/settings");
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
if (error) {
|
||||
router.push("/settings");
|
||||
}
|
||||
},
|
||||
[error]
|
||||
);
|
||||
const isAdmin =
|
||||
team && (team.membership.role === MembershipRole.OWNER || team.membership.role === MembershipRole.ADMIN);
|
||||
|
||||
@@ -142,7 +151,7 @@ const ProfileView = () => {
|
||||
});
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
if (isPending) {
|
||||
return <SkeletonLoader title={t("profile")} description={t("profile_team_description")} />;
|
||||
}
|
||||
|
||||
@@ -405,7 +414,7 @@ const TeamProfileForm = ({ team }: TeamProfileFormProps) => {
|
||||
<p className="text-default mt-2 text-sm">{t("team_description")}</p>
|
||||
</div>
|
||||
<SectionBottomActions align="end">
|
||||
<Button color="primary" type="submit" loading={mutation.isLoading} disabled={isDisabled}>
|
||||
<Button color="primary" type="submit" loading={mutation.isPending} disabled={isDisabled}>
|
||||
{t("update")}
|
||||
</Button>
|
||||
{IS_TEAM_BILLING_ENABLED &&
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { keepPreviousData } from "@tanstack/react-query";
|
||||
import { signIn } from "next-auth/react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
@@ -76,7 +77,7 @@ function UsersTableBare() {
|
||||
},
|
||||
{
|
||||
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
||||
keepPreviousData: true,
|
||||
placeholderData: keepPreviousData,
|
||||
refetchOnWindowFocus: false,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -57,9 +57,9 @@ function exclude<UserType, Key extends keyof UserType>(user: UserType, keys: Key
|
||||
/** Reusable logic that checks for admin permissions and if the requested user exists */
|
||||
//const authedAdminWithUserMiddleware = middleware();
|
||||
|
||||
const authedAdminProcedureWithRequestedUser = authedAdminProcedure.use(async ({ ctx, next, rawInput }) => {
|
||||
const authedAdminProcedureWithRequestedUser = authedAdminProcedure.use(async ({ ctx, next, getRawInput }) => {
|
||||
const { prisma } = ctx;
|
||||
const parsed = userIdSchema.safeParse(rawInput);
|
||||
const parsed = userIdSchema.safeParse(await getRawInput());
|
||||
if (!parsed.success) throw new TRPCError({ code: "BAD_REQUEST", message: "User id is required" });
|
||||
const { userId: id } = parsed.data;
|
||||
const user = await prisma.user.findUnique({ where: { id } });
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState, Suspense } from "react";
|
||||
import { useState, Suspense, useEffect } from "react";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
|
||||
@@ -64,18 +64,21 @@ const useRecordingDownload = () => {
|
||||
},
|
||||
{
|
||||
enabled: !!recordingId,
|
||||
cacheTime: 0,
|
||||
gcTime: 0,
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
retry: false,
|
||||
onSuccess: (data) => {
|
||||
if (data && data.download_link) {
|
||||
window.location.href = data.download_link;
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
if (data && data.download_link) {
|
||||
window.location.href = data.download_link;
|
||||
}
|
||||
},
|
||||
[data]
|
||||
);
|
||||
return {
|
||||
setRecordingId: (newRecordingId: string) => {
|
||||
// may be a way to do this by default, but this is easy enough.
|
||||
@@ -157,7 +160,7 @@ export const ViewRecordingsDialog = (props: IViewRecordingsDialog) => {
|
||||
const { t, i18n } = useLocale();
|
||||
const { isOpenDialog, setIsOpenDialog, booking, timeFormat } = props;
|
||||
|
||||
const { hasTeamPlan, isLoading: isTeamPlanStatusLoading } = useHasTeamPlan();
|
||||
const { hasTeamPlan, isPending: isTeamPlanStatusLoading } = useHasTeamPlan();
|
||||
|
||||
const roomName =
|
||||
booking?.references?.find((reference: PartialReference) => reference.type === "daily_video")?.meetingId ??
|
||||
|
||||
@@ -40,7 +40,7 @@ export const DeleteDialog = (props: IDeleteDialog) => {
|
||||
return (
|
||||
<Dialog open={isOpenDialog} onOpenChange={setIsOpenDialog}>
|
||||
<ConfirmationDialogContent
|
||||
isLoading={deleteMutation.isLoading}
|
||||
isPending={deleteMutation.isPending}
|
||||
variety="danger"
|
||||
title={t("delete_workflow")}
|
||||
confirmBtnText={t("confirm_delete_workflow")}
|
||||
|
||||
@@ -82,7 +82,7 @@ export default function EmptyScreen(props: { isFilteredView: boolean }) {
|
||||
subtitle={t("new_workflow_subtitle").toUpperCase()}
|
||||
createFunction={(teamId?: number) => createMutation.mutate({ teamId })}
|
||||
buttonText={t("create_workflow")}
|
||||
isLoading={createMutation.isLoading}
|
||||
isPending={createMutation.isPending}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -205,7 +205,7 @@ function EventWorkflowsTab(props: Props) {
|
||||
t("locked_fields_admin_description"),
|
||||
t("locked_fields_member_description")
|
||||
);
|
||||
const { data, isLoading } = trpc.viewer.workflows.list.useQuery({
|
||||
const { data, isPending } = trpc.viewer.workflows.list.useQuery({
|
||||
teamId: eventType.team?.id,
|
||||
userId: !isChildrenManagedEventType ? eventType.userId || undefined : undefined,
|
||||
});
|
||||
@@ -231,7 +231,7 @@ function EventWorkflowsTab(props: Props) {
|
||||
);
|
||||
setSortedWorkflows(activeWorkflows.concat(disabledWorkflows));
|
||||
}
|
||||
}, [isLoading]);
|
||||
}, [isPending]);
|
||||
|
||||
const createMutation = trpc.viewer.workflows.create.useMutation({
|
||||
onSuccess: async ({ workflow }) => {
|
||||
@@ -252,7 +252,7 @@ function EventWorkflowsTab(props: Props) {
|
||||
|
||||
return (
|
||||
<LicenseRequired>
|
||||
{!isLoading ? (
|
||||
{!isPending ? (
|
||||
<>
|
||||
{isManagedEventType && (
|
||||
<Alert
|
||||
@@ -288,7 +288,7 @@ function EventWorkflowsTab(props: Props) {
|
||||
target="_blank"
|
||||
color="secondary"
|
||||
onClick={() => createMutation.mutate({ teamId: eventType.team?.id })}
|
||||
loading={createMutation.isLoading}>
|
||||
loading={createMutation.isPending}>
|
||||
{t("create_workflow")}
|
||||
</Button>
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
const [reload, setReload] = useState(false);
|
||||
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
||||
|
||||
const { data, isLoading } = trpc.viewer.eventTypes.getByViewer.useQuery();
|
||||
const { data, isPending } = trpc.viewer.eventTypes.getByViewer.useQuery();
|
||||
|
||||
const eventTypeOptions = useMemo(
|
||||
() =>
|
||||
@@ -138,7 +138,7 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
<MultiSelectCheckboxes
|
||||
options={allEventTypeOptions}
|
||||
isDisabled={props.readOnly}
|
||||
isLoading={isLoading}
|
||||
isLoading={isPending}
|
||||
className="w-full md:w-64"
|
||||
setSelected={setSelectedEventTypes}
|
||||
selected={selectedEventTypes}
|
||||
|
||||
@@ -614,7 +614,7 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
|
||||
<Button
|
||||
color="secondary"
|
||||
className="-ml-[3px] h-[36px] min-w-fit py-0 sm:block sm:rounded-bl-none sm:rounded-tl-none "
|
||||
disabled={verifyPhoneNumberMutation.isLoading || props.readOnly}
|
||||
disabled={verifyPhoneNumberMutation.isPending || props.readOnly}
|
||||
onClick={() => {
|
||||
verifyPhoneNumberMutation.mutate({
|
||||
phoneNumber: form.getValues(`steps.${step.stepNumber - 1}.sendTo`) || "",
|
||||
|
||||
@@ -64,7 +64,7 @@ function WorkflowsPage() {
|
||||
createFunction={(teamId?: number) => {
|
||||
createMutation.mutate({ teamId });
|
||||
}}
|
||||
isLoading={createMutation.isLoading}
|
||||
isPending={createMutation.isPending}
|
||||
disableMobileButton={true}
|
||||
onlyShowWithNoTeams={true}
|
||||
/>
|
||||
@@ -79,7 +79,7 @@ function WorkflowsPage() {
|
||||
<CreateButtonWithTeamsList
|
||||
subtitle={t("new_workflow_subtitle").toUpperCase()}
|
||||
createFunction={(teamId?: number) => createMutation.mutate({ teamId })}
|
||||
isLoading={createMutation.isLoading}
|
||||
isPending={createMutation.isPending}
|
||||
disableMobileButton={true}
|
||||
onlyShowWithTeams={true}
|
||||
/>
|
||||
|
||||
@@ -109,7 +109,7 @@ function WorkflowPage() {
|
||||
data: workflow,
|
||||
isError,
|
||||
error,
|
||||
isLoading,
|
||||
isPending,
|
||||
} = trpc.viewer.workflows.get.useQuery(
|
||||
{ id: +workflowId },
|
||||
{
|
||||
@@ -129,7 +129,7 @@ function WorkflowPage() {
|
||||
MembershipRole.MEMBER;
|
||||
|
||||
useEffect(() => {
|
||||
if (workflow && !isLoading) {
|
||||
if (workflow && !isPending) {
|
||||
if (workflow.userId && workflow.activeOn.find((active) => !!active.eventType.teamId)) {
|
||||
setIsMixedEventType(true);
|
||||
}
|
||||
@@ -179,7 +179,7 @@ function WorkflowPage() {
|
||||
form.setValue("activeOn", activeOn || []);
|
||||
setIsAllDataLoaded(true);
|
||||
}
|
||||
}, [isLoading]);
|
||||
}, [isPending]);
|
||||
|
||||
const updateMutation = trpc.viewer.workflows.update.useMutation({
|
||||
onSuccess: async ({ workflow }) => {
|
||||
@@ -269,7 +269,7 @@ function WorkflowPage() {
|
||||
CTA={
|
||||
!readOnly && (
|
||||
<div>
|
||||
<Button data-testid="save-workflow" type="submit" loading={updateMutation.isLoading}>
|
||||
<Button data-testid="save-workflow" type="submit" loading={updateMutation.isPending}>
|
||||
{t("save")}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user