Skip to content

Commit 7594c61

Browse files
fix: atoms useCheck and bump atoms version (#15390)
1 parent 4aa84ea commit 7594c61

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

packages/platform/atoms/connect/OAuthConnect.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { Button } from "@calcom/ui";
66
import type { OnCheckErrorType } from "../hooks/connect/useCheck";
77
import { useCheck } from "../hooks/connect/useCheck";
88
import { useConnect } from "../hooks/connect/useConnect";
9-
import { useAtomsContext } from "../hooks/useAtomsContext";
109
import { AtomsWrapper } from "../src/components/atoms-wrapper";
1110
import { cn } from "../src/lib/utils";
1211

@@ -28,16 +27,14 @@ export const OAuthConnect: FC<OAuthConnectProps & { calendar: (typeof CALENDARS)
2827
calendar,
2928
redir,
3029
}) => {
31-
const { isAuth } = useAtomsContext();
3230
const { connect } = useConnect(calendar, redir);
3331

3432
const { allowConnect, checked } = useCheck({
35-
isAuth,
3633
onCheckError,
3734
calendar: calendar,
3835
});
3936

40-
const isChecking = !isAuth || !checked;
37+
const isChecking = !checked;
4138
const isDisabled = isChecking || !allowConnect;
4239

4340
let displayedLabel = label;

packages/platform/atoms/hooks/connect/useCheck.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@ import { SUCCESS_STATUS, ERROR_STATUS } from "@calcom/platform-constants";
55
import type { ApiResponse, ApiErrorResponse } from "@calcom/platform-types";
66

77
import http from "../../lib/http";
8+
import { useAtomsContext } from "../useAtomsContext";
89

910
export interface UseCheckProps {
10-
isAuth: boolean;
1111
onCheckError?: OnCheckErrorType;
1212
calendar: (typeof CALENDARS)[number];
1313
}
1414
export type OnCheckErrorType = (err: ApiErrorResponse) => void;
1515
export const getQueryKey = (calendar: (typeof CALENDARS)[number]) => [`get-${calendar}-check`];
1616

17-
export const useCheck = ({ isAuth, onCheckError, calendar }: UseCheckProps) => {
17+
export const useCheck = ({ onCheckError, calendar }: UseCheckProps) => {
18+
const { isInit } = useAtomsContext();
1819
const { data: check } = useQuery({
1920
queryKey: getQueryKey(calendar),
2021
staleTime: 6000,
21-
enabled: isAuth,
22+
enabled: isInit,
2223
queryFn: () => {
2324
return http
2425
?.get<ApiResponse<{ checked: boolean; allowConnect: boolean }>>(`/calendars/${calendar}/check`)

packages/platform/atoms/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "module",
55
"description": "Customizable UI components to integrate scheduling into your product.",
66
"authors": "Cal.com, Inc.",
7-
"version": "1.0.40",
7+
"version": "1.0.52",
88
"scripts": {
99
"dev": "yarn vite build --watch & npx tailwindcss -i ./globals.css -o ./globals.min.css --postcss --minify --watch",
1010
"build": "yarn vite build && npx tailwindcss -i ./globals.css -o ./globals.min.css --postcss --minify && mkdir ./dist/packages/prisma-client && cp -rf ../../../node_modules/.prisma/client/*.d.ts ./dist/packages/prisma-client",

0 commit comments

Comments
 (0)