Skip to content
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

chore: downgrade react query atoms #14328

Merged
merged 8 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/features/bookings/Booker/Booker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const BookerComponent = ({
} = calendars;

useEffect(() => {
if (event.isPending) return setBookerState("loading");
if (event.isLoading) return setBookerState("loading");
if (!selectedDate) return setBookerState("selecting_date");
if (!selectedTimeslot) return setBookerState("selecting_time");
return setBookerState("booking");
Expand Down Expand Up @@ -354,7 +354,7 @@ const BookerComponent = ({
/>
)}

<EventMeta event={event.data} isPending={event.isPending} isPlatform={isPlatform} />
<EventMeta event={event.data} isPending={event.isLoading} isPlatform={isPlatform} />
{layout !== BookerLayouts.MONTH_VIEW &&
!(layout === "mobile" && bookerState === "booking") && (
<div className="mt-auto px-5 py-3 ">
Expand Down Expand Up @@ -392,7 +392,7 @@ const BookerComponent = ({
<LargeCalendar
extraDays={extraDays}
schedule={schedule.data}
isLoading={schedule.isPending}
isLoading={schedule.isLoading}
event={event}
/>
</BookerSection>
Expand All @@ -416,7 +416,7 @@ const BookerComponent = ({
extraDays={extraDays}
limitHeight={layout === BookerLayouts.MONTH_VIEW}
schedule={schedule?.data}
isLoading={schedule.isPending}
isLoading={schedule.isLoading}
seatsPerTimeSlot={event.data?.seatsPerTimeSlot}
showAvailableSeatsCount={event.data?.seatsShowAvailabilityCount}
event={event}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { FieldError } from "react-hook-form";
import { IS_CALCOM, WEBSITE_URL } from "@calcom/lib/constants";
import getPaymentAppData from "@calcom/lib/getPaymentAppData";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Alert, Button, EmptyScreen, Form, Icon } from "@calcom/ui";
import { Alert, Button, EmptyScreen, Form } from "@calcom/ui";

import { useBookerStore } from "../../store";
import type { useEventReturnType } from "../../utils/event";
Expand Down Expand Up @@ -63,7 +63,7 @@ export const BookEventForm = ({
}, [eventType]);

if (eventQuery.isError) return <Alert severity="warning" message={t("error_booking_event")} />;
if (eventQuery.isPending || !eventQuery.data) return <FormSkeleton />;
if (eventQuery.isLoading || !eventQuery.data) return <FormSkeleton />;
if (!timeslot)
return (
<EmptyScreen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const DatePicker = ({

return (
<DatePickerComponent
isPending={schedule.isPending}
isPending={schedule.isLoading}
onChange={(date: Dayjs | null) => {
setSelectedDate(date === null ? date : date.format("YYYY-MM-DD"));
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/features/bookings/Booker/components/EventMeta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const EventMeta = ({
isPlatform = true,
}: {
event: useEventReturnType["data"];
isPending: useEventReturnType["isPending"];
isPending: useEventReturnType["isLoading"];
isPlatform?: boolean;
}) => {
const { setTimezone, timeFormat, timezone } = useTimePreferences();
Expand Down
3 changes: 1 addition & 2 deletions packages/features/bookings/Booker/utils/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const useEvent = () => {
data: event?.data,
isSuccess: event?.isSuccess,
isError: event?.isError,
isPending: event?.isPending,
isLoading: event?.isPending,
};
};

Expand Down Expand Up @@ -104,7 +104,6 @@ export const useScheduleForEvent = ({

return {
data: schedule?.data,
isPending: schedule?.isPending,
isError: schedule?.isError,
isSuccess: schedule?.isSuccess,
isLoading: schedule?.isLoading,
Expand Down
11 changes: 2 additions & 9 deletions packages/platform/atoms/availability/AvailabilitySettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,7 @@ const DateOverride = ({
onChange={(ranges) => ranges.forEach((range) => append({ ranges: [range] }))}
userTimeFormat={userTimeFormat}
Trigger={
<Button
color="secondary"
StartIcon="plus"
data-testid="add-override">
<Button color="secondary" StartIcon="plus" data-testid="add-override">
{t("add_an_override")}
</Button>
}
Expand Down Expand Up @@ -324,11 +321,7 @@ export function AvailabilitySettings({
openSidebar ? "translate-x-0 opacity-100" : "translate-x-full opacity-0"
)}>
<div className="flex flex-row items-center pt-5">
<Button
StartIcon="arrow-left"
color="minimal"
onClick={() => setOpenSidebar(false)}
/>
<Button StartIcon="arrow-left" color="minimal" onClick={() => setOpenSidebar(false)} />
<p className="-ml-2">{t("availability_settings")}</p>
<DeleteDialogButton
buttonClassName="ml-16 inline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const PlatformAvailabilitySettingsWrapper = ({
const { timeFormat } = me?.data || { timeFormat: null };
const { toast } = useToast();

const { mutate: deleteSchedule, isPending: isDeletionInProgress } = useDeleteSchedule({
const { mutate: deleteSchedule, isLoading: isDeletionInProgress } = useDeleteSchedule({
onSuccess: (res) => {
onDeleteSuccess?.(res);
toast({
Expand All @@ -54,7 +54,7 @@ export const PlatformAvailabilitySettingsWrapper = ({
},
});

const { mutate: updateSchedule, isPending: isSavingInProgress } = useUpdateSchedule({
const { mutate: updateSchedule, isLoading: isSavingInProgress } = useUpdateSchedule({
onSuccess: (res) => {
onUpdateSuccess?.(res);
toast({
Expand Down Expand Up @@ -98,28 +98,24 @@ export const PlatformAvailabilitySettingsWrapper = ({
weekStart="Sunday"
timeFormat={timeFormat}
isLoading={isLoading}
schedule={
userSchedule
? {
name: userSchedule.name,
id: userSchedule.id,
isLastSchedule: userSchedule.isLastSchedule,
isDefault: userSchedule.isDefault,
workingHours: userSchedule.workingHours,
dateOverrides: userSchedule.dateOverrides,
timeZone: userSchedule.timeZone,
availability: userSchedule.availability,
schedule:
userSchedule.schedule.reduce(
(acc: Schedule[], avail: Schedule) => [
...acc,
{ ...avail, startTime: new Date(avail.startTime), endTime: new Date(avail.endTime) },
],
[] as Schedule[]
) || [],
}
: undefined
}
schedule={{
name: userSchedule.name,
id: userSchedule.id,
isLastSchedule: userSchedule.isLastSchedule,
isDefault: userSchedule.isDefault,
workingHours: userSchedule.workingHours,
dateOverrides: userSchedule.dateOverrides,
timeZone: userSchedule.timeZone,
availability: userSchedule.availability,
schedule:
userSchedule.schedule.reduce(
(acc: Schedule[], avail: Schedule) => [
...acc,
{ ...avail, startTime: new Date(avail.startTime), endTime: new Date(avail.endTime) },
],
[] as Schedule[]
) || [],
}}
isDeleting={isDeletionInProgress}
isSaving={isSavingInProgress}
backPath=""
Expand Down
8 changes: 4 additions & 4 deletions packages/platform/atoms/booker/BookerPlatformWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const BookerPlatformWrapper = (props: BookerPlatformWrapperAtomProps) =>
});
const {
mutate: createBooking,
isPending: creatingBooking,
isLoading: creatingBooking,
error: createBookingError,
isError: isCreateBookingError,
} = useCreateBooking({
Expand All @@ -164,7 +164,7 @@ export const BookerPlatformWrapper = (props: BookerPlatformWrapperAtomProps) =>
});
const {
mutate: createRecBooking,
isPending: creatingRecBooking,
isLoading: creatingRecBooking,

error: createRecBookingError,
isError: isCreateRecBookingError,
Expand All @@ -177,7 +177,7 @@ export const BookerPlatformWrapper = (props: BookerPlatformWrapperAtomProps) =>
});
const {
mutate: createInstantBooking,
isPending: creatingInstantBooking,
isLoading: creatingInstantBooking,
error: createInstantBookingError,
isError: isCreateInstantBookingError,
} = useCreateInstantBooking({
Expand All @@ -193,7 +193,7 @@ export const BookerPlatformWrapper = (props: BookerPlatformWrapperAtomProps) =>
(state) => [state.calendarSettingsOverlayModal, state.setCalendarSettingsOverlayModal],
shallow
);
const { data: connectedCalendars, isPending: fetchingConnectedCalendars } = useConnectedCalendars({
const { data: connectedCalendars, isLoading: fetchingConnectedCalendars } = useConnectedCalendars({
enabled: !!calendarSettingsOverlay,
});
const calendars = connectedCalendars as ConnectedDestinationCalendars;
Expand Down
4 changes: 2 additions & 2 deletions packages/platform/atoms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "module",
"description": "Customizable UI components to integrate scheduling into your product.",
"authors": "Cal.com, Inc.",
"version": "1.0.6",
"version": "1.0.8",
"scripts": {
"dev": "yarn vite build --watch & npx tailwindcss -i ./globals.css -o ./globals.min.css --postcss --minify --watch",
"build": "yarn vite build && npx tailwindcss -i ./globals.css -o ./globals.min.css --postcss --minify",
Expand Down Expand Up @@ -44,7 +44,7 @@
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"@tanstack/react-query": "^5.17.15",
"@tanstack/react-query": "4.36.1",
"class-variance-authority": "^0.4.0",
"clsx": "^2.0.0",
"lucide-react": "^0.364.0",
Expand Down
Loading
Loading