Revert "chore: downgrade react query atoms (#14328)" (#14332)

This reverts commit 8fc9b9ae9d.
This commit is contained in:
Lauris Skraucis
2024-04-04 10:55:15 +00:00
committed by GitHub
parent 8fc9b9ae9d
commit d7ece4f583
11 changed files with 140 additions and 51 deletions
+4 -4
View File
@@ -134,7 +134,7 @@ const BookerComponent = ({
} = calendars;
useEffect(() => {
if (event.isLoading) return setBookerState("loading");
if (event.isPending) return setBookerState("loading");
if (!selectedDate) return setBookerState("selecting_date");
if (!selectedTimeslot) return setBookerState("selecting_time");
return setBookerState("booking");
@@ -354,7 +354,7 @@ const BookerComponent = ({
/>
)}
<EventMeta event={event.data} isPending={event.isLoading} isPlatform={isPlatform} />
<EventMeta event={event.data} isPending={event.isPending} isPlatform={isPlatform} />
{layout !== BookerLayouts.MONTH_VIEW &&
!(layout === "mobile" && bookerState === "booking") && (
<div className="mt-auto px-5 py-3 ">
@@ -392,7 +392,7 @@ const BookerComponent = ({
<LargeCalendar
extraDays={extraDays}
schedule={schedule.data}
isLoading={schedule.isLoading}
isLoading={schedule.isPending}
event={event}
/>
</BookerSection>
@@ -416,7 +416,7 @@ const BookerComponent = ({
extraDays={extraDays}
limitHeight={layout === BookerLayouts.MONTH_VIEW}
schedule={schedule?.data}
isLoading={schedule.isLoading}
isLoading={schedule.isPending}
seatsPerTimeSlot={event.data?.seatsPerTimeSlot}
showAvailableSeatsCount={event.data?.seatsShowAvailabilityCount}
event={event}
@@ -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 } from "@calcom/ui";
import { Alert, Button, EmptyScreen, Form, Icon } from "@calcom/ui";
import { useBookerStore } from "../../store";
import type { useEventReturnType } from "../../utils/event";
@@ -63,7 +63,7 @@ export const BookEventForm = ({
}, [eventType]);
if (eventQuery.isError) return <Alert severity="warning" message={t("error_booking_event")} />;
if (eventQuery.isLoading || !eventQuery.data) return <FormSkeleton />;
if (eventQuery.isPending || !eventQuery.data) return <FormSkeleton />;
if (!timeslot)
return (
<EmptyScreen
@@ -27,7 +27,7 @@ export const DatePicker = ({
return (
<DatePickerComponent
isPending={schedule.isLoading}
isPending={schedule.isPending}
onChange={(date: Dayjs | null) => {
setSelectedDate(date === null ? date : date.format("YYYY-MM-DD"));
}}
@@ -29,7 +29,7 @@ export const EventMeta = ({
isPlatform = true,
}: {
event: useEventReturnType["data"];
isPending: useEventReturnType["isLoading"];
isPending: useEventReturnType["isPending"];
isPlatform?: boolean;
}) => {
const { setTimezone, timeFormat, timezone } = useTimePreferences();
@@ -33,7 +33,7 @@ export const useEvent = () => {
data: event?.data,
isSuccess: event?.isSuccess,
isError: event?.isError,
isLoading: event?.isPending,
isPending: event?.isPending,
};
};
@@ -104,6 +104,7 @@ export const useScheduleForEvent = ({
return {
data: schedule?.data,
isPending: schedule?.isPending,
isError: schedule?.isError,
isSuccess: schedule?.isSuccess,
isLoading: schedule?.isLoading,
+1 -1
View File
@@ -240,7 +240,7 @@ const EmailEmbed = ({
<CollapsibleContent>
<div className="text-default text-sm">{t("select_date")}</div>
<DatePicker
isPending={schedule.isLoading}
isPending={schedule.isPending}
onChange={(date: Dayjs | null) => {
setSelectedDate(date === null ? date : date.format("YYYY-MM-DD"));
}}
@@ -178,7 +178,10 @@ 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>
}
@@ -321,7 +324,11 @@ 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"
@@ -39,7 +39,7 @@ export const PlatformAvailabilitySettingsWrapper = ({
const { timeFormat } = me?.data || { timeFormat: null };
const { toast } = useToast();
const { mutate: deleteSchedule, isLoading: isDeletionInProgress } = useDeleteSchedule({
const { mutate: deleteSchedule, isPending: isDeletionInProgress } = useDeleteSchedule({
onSuccess: (res) => {
onDeleteSuccess?.(res);
toast({
@@ -54,7 +54,7 @@ export const PlatformAvailabilitySettingsWrapper = ({
},
});
const { mutate: updateSchedule, isLoading: isSavingInProgress } = useUpdateSchedule({
const { mutate: updateSchedule, isPending: isSavingInProgress } = useUpdateSchedule({
onSuccess: (res) => {
onUpdateSuccess?.(res);
toast({
@@ -98,24 +98,28 @@ export const PlatformAvailabilitySettingsWrapper = ({
weekStart="Sunday"
timeFormat={timeFormat}
isLoading={isLoading}
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[]
) || [],
}}
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
}
isDeleting={isDeletionInProgress}
isSaving={isSavingInProgress}
backPath=""
@@ -152,7 +152,7 @@ export const BookerPlatformWrapper = (props: BookerPlatformWrapperAtomProps) =>
});
const {
mutate: createBooking,
isLoading: creatingBooking,
isPending: creatingBooking,
error: createBookingError,
isError: isCreateBookingError,
} = useCreateBooking({
@@ -164,7 +164,7 @@ export const BookerPlatformWrapper = (props: BookerPlatformWrapperAtomProps) =>
});
const {
mutate: createRecBooking,
isLoading: creatingRecBooking,
isPending: creatingRecBooking,
error: createRecBookingError,
isError: isCreateRecBookingError,
@@ -177,7 +177,7 @@ export const BookerPlatformWrapper = (props: BookerPlatformWrapperAtomProps) =>
});
const {
mutate: createInstantBooking,
isLoading: creatingInstantBooking,
isPending: creatingInstantBooking,
error: createInstantBookingError,
isError: isCreateInstantBookingError,
} = useCreateInstantBooking({
@@ -193,7 +193,7 @@ export const BookerPlatformWrapper = (props: BookerPlatformWrapperAtomProps) =>
(state) => [state.calendarSettingsOverlayModal, state.setCalendarSettingsOverlayModal],
shallow
);
const { data: connectedCalendars, isLoading: fetchingConnectedCalendars } = useConnectedCalendars({
const { data: connectedCalendars, isPending: fetchingConnectedCalendars } = useConnectedCalendars({
enabled: !!calendarSettingsOverlay,
});
const calendars = connectedCalendars as ConnectedDestinationCalendars;
+2 -2
View File
@@ -4,7 +4,7 @@
"type": "module",
"description": "Customizable UI components to integrate scheduling into your product.",
"authors": "Cal.com, Inc.",
"version": "1.0.9",
"version": "1.0.6",
"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",
@@ -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": "4.36.1",
"@tanstack/react-query": "^5.17.15",
"class-variance-authority": "^0.4.0",
"clsx": "^2.0.0",
"lucide-react": "^0.364.0",
+90 -13
View File
@@ -290,6 +290,25 @@ __metadata:
languageName: node
linkType: hard
"@auth/core@npm:^0.1.4":
version: 0.1.4
resolution: "@auth/core@npm:0.1.4"
dependencies:
"@panva/hkdf": 1.0.2
cookie: 0.5.0
jose: 4.11.1
oauth4webapi: 2.0.5
preact: 10.11.3
preact-render-to-string: 5.2.3
peerDependencies:
nodemailer: 6.8.0
peerDependenciesMeta:
nodemailer:
optional: true
checksum: 64854404ea1883e0deb5535b34bed95cd43fc85094aeaf4f15a79e14045020eb944f844defe857edfc8528a0a024be89cbb2a3069dedef0e9217a74ca6c3eb79
languageName: node
linkType: hard
"@aw-web-design/x-default-browser@npm:1.4.126":
version: 1.4.126
resolution: "@aw-web-design/x-default-browser@npm:1.4.126"
@@ -4012,7 +4031,7 @@ __metadata:
"@radix-ui/react-slot": ^1.0.2
"@radix-ui/react-toast": ^1.1.5
"@rollup/plugin-node-resolve": ^15.0.1
"@tanstack/react-query": 4.36.1
"@tanstack/react-query": ^5.17.15
"@types/node": ^20.3.1
"@types/react": 18.0.26
"@types/react-dom": ^18.0.9
@@ -4031,6 +4050,41 @@ __metadata:
languageName: unknown
linkType: soft
"@calcom/auth@workspace:apps/auth":
version: 0.0.0-use.local
resolution: "@calcom/auth@workspace:apps/auth"
dependencies:
"@auth/core": ^0.1.4
"@calcom/app-store": "*"
"@calcom/app-store-cli": "*"
"@calcom/config": "*"
"@calcom/core": "*"
"@calcom/dayjs": "*"
"@calcom/embed-core": "workspace:*"
"@calcom/embed-react": "workspace:*"
"@calcom/embed-snippet": "workspace:*"
"@calcom/features": "*"
"@calcom/lib": "*"
"@calcom/prisma": "*"
"@calcom/trpc": "*"
"@calcom/tsconfig": "*"
"@calcom/types": "*"
"@calcom/ui": "*"
"@types/node": 16.9.1
"@types/react": 18.0.26
"@types/react-dom": ^18.0.9
eslint: ^8.34.0
eslint-config-next: ^13.2.1
next: ^13.5.4
next-auth: ^4.22.1
postcss: ^8.4.18
react: ^18.2.0
react-dom: ^18.2.0
tailwindcss: ^3.3.3
typescript: ^4.9.4
languageName: unknown
linkType: soft
"@calcom/base@workspace:packages/platform/examples/base":
version: 0.0.0-use.local
resolution: "@calcom/base@workspace:packages/platform/examples/base"
@@ -5391,7 +5445,7 @@ __metadata:
i18n-unused: ^0.13.0
iframe-resizer-react: ^1.1.0
keen-slider: ^6.8.0
lucide-react: ^0.171.0
lucide-react: ^0.364.0
micro: ^10.0.1
next: ^14.1.3
next-auth: ^4.22.1
@@ -10219,6 +10273,13 @@ __metadata:
languageName: node
linkType: hard
"@panva/hkdf@npm:1.0.2":
version: 1.0.2
resolution: "@panva/hkdf@npm:1.0.2"
checksum: 75183b4d5ea816ef516dcea70985c610683579a9e2ac540c2d59b9a3ed27eedaff830a43a1c43c1683556a457c92ac66e09109ee995ab173090e4042c4c4bb03
languageName: node
linkType: hard
"@panva/hkdf@npm:^1.0.2":
version: 1.0.4
resolution: "@panva/hkdf@npm:1.0.4"
@@ -14989,7 +15050,7 @@ __metadata:
languageName: node
linkType: hard
"@tanstack/react-query@npm:4.36.1, @tanstack/react-query@npm:^4.3.9":
"@tanstack/react-query@npm:^4.3.9":
version: 4.36.1
resolution: "@tanstack/react-query@npm:4.36.1"
dependencies:
@@ -30794,6 +30855,13 @@ __metadata:
languageName: node
linkType: hard
"jose@npm:4.11.1":
version: 4.11.1
resolution: "jose@npm:4.11.1"
checksum: cd15cba258d0fd20f6168631ce2e94fda8442df80e43c1033c523915cecdf390a1cc8efe0eab0c2d65935ca973d791c668aea80724d2aa9c2879d4e70f3081d7
languageName: node
linkType: hard
"jose@npm:5.2.1":
version: 5.2.1
resolution: "jose@npm:5.2.1"
@@ -32767,15 +32835,6 @@ __metadata:
languageName: node
linkType: hard
"lucide-react@npm:^0.171.0":
version: 0.171.0
resolution: "lucide-react@npm:0.171.0"
peerDependencies:
react: ^16.5.1 || ^17.0.0 || ^18.0.0
checksum: 768ffe368c52a518ee339203d86ff4479989ab4d79c0716f721900c4bb7392ef6ff7a14807f6a685abd74d27f4c1778170bff77a0ab4c3e06c17944b557d8300
languageName: node
linkType: hard
"lucide-react@npm:^0.364.0":
version: 0.364.0
resolution: "lucide-react@npm:0.364.0"
@@ -35774,6 +35833,13 @@ __metadata:
languageName: node
linkType: hard
"oauth4webapi@npm:2.0.5":
version: 2.0.5
resolution: "oauth4webapi@npm:2.0.5"
checksum: 32d0cb7b1cca42d51dfb88075ca2d69fe33172a807e8ea50e317d17cab3bc80588ab8ebcb7eb4600c371a70af4674595b4b341daf6f3a655f1efa1ab715bb6c9
languageName: node
linkType: hard
"oauth@npm:^0.9.15":
version: 0.9.15
resolution: "oauth@npm:0.9.15"
@@ -37904,6 +37970,17 @@ __metadata:
languageName: node
linkType: hard
"preact-render-to-string@npm:5.2.3":
version: 5.2.3
resolution: "preact-render-to-string@npm:5.2.3"
dependencies:
pretty-format: ^3.8.0
peerDependencies:
preact: ">=10"
checksum: 6e46288d8956adde35b9fe3a21aecd9dea29751b40f0f155dea62f3896f27cb8614d457b32f48d33909d2da81135afcca6c55077520feacd7d15164d1371fb44
languageName: node
linkType: hard
"preact-render-to-string@npm:^5.1.19":
version: 5.2.6
resolution: "preact-render-to-string@npm:5.2.6"
@@ -37915,7 +37992,7 @@ __metadata:
languageName: node
linkType: hard
"preact@npm:^10.6.3":
"preact@npm:10.11.3, preact@npm:^10.6.3":
version: 10.11.3
resolution: "preact@npm:10.11.3"
checksum: 9387115aa0581e8226309e6456e9856f17dfc0e3d3e63f774de80f3d462a882ba7c60914c05942cb51d51e23e120dcfe904b8d392d46f29ad15802941fe7a367