From c6408fc5b3075c655678f36310ad2b29d7abe6dd Mon Sep 17 00:00:00 2001 From: unrenamed Date: Fri, 15 Nov 2024 15:44:21 +0200 Subject: [PATCH 1/2] fix: add biome-ignore to hooks that work as expected --- .../app/(app)/apis/[apiId]/keys/[keyAuthId]/new/client.tsx | 1 + apps/dashboard/app/(app)/settings/root-keys/new/client.tsx | 1 + apps/dashboard/app/auth/sign-in/email-signin.tsx | 5 +++-- apps/dashboard/app/auth/sign-up/email-signup.tsx | 7 +++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/new/client.tsx b/apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/new/client.tsx index f37da70b3b..46a6d5b4cb 100644 --- a/apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/new/client.tsx +++ b/apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/new/client.tsx @@ -259,6 +259,7 @@ export const CreateKey: React.FC = ({ apiId, keyAuthId, defaultBytes, def form.resetField("limit", undefined); }; + // biome-ignore lint/correctness/useExhaustiveDependencies: reset is only required on mount useEffect(() => { // React hook form + zod doesn't play nice with nested objects, so we need to reset them on load. resetRateLimit(); diff --git a/apps/dashboard/app/(app)/settings/root-keys/new/client.tsx b/apps/dashboard/app/(app)/settings/root-keys/new/client.tsx index 3fe8c58a45..35192bcf9a 100644 --- a/apps/dashboard/app/(app)/settings/root-keys/new/client.tsx +++ b/apps/dashboard/app/(app)/settings/root-keys/new/client.tsx @@ -93,6 +93,7 @@ export const Client: React.FC = ({ apis }) => { })); }; + // biome-ignore lint/correctness/useExhaustiveDependencies: effect must be called once to set initial cards state useEffect(() => { const initialSelectedApiSet = new Set(); selectedPermissions.forEach((permission) => { diff --git a/apps/dashboard/app/auth/sign-in/email-signin.tsx b/apps/dashboard/app/auth/sign-in/email-signin.tsx index a88a998e96..96243772dd 100644 --- a/apps/dashboard/app/auth/sign-in/email-signin.tsx +++ b/apps/dashboard/app/auth/sign-in/email-signin.tsx @@ -20,13 +20,14 @@ export function EmailSignIn(props: { const router = useRouter(); const [lastUsed, setLastUsed] = useLastUsed(); - // biome-igmore lint: this works + // biome-ignore lint/correctness/useExhaustiveDependencies: effect must be called once if sign-in is loaded React.useEffect(() => { const signUpOrgUser = async () => { - const ticket = new URL(window.location.href).searchParams.get(param); if (!signInLoaded) { return; } + + const ticket = new URL(window.location.href).searchParams.get(param); if (!ticket) { return; } diff --git a/apps/dashboard/app/auth/sign-up/email-signup.tsx b/apps/dashboard/app/auth/sign-up/email-signup.tsx index ff7c527d3f..2fbc4d40f9 100644 --- a/apps/dashboard/app/auth/sign-up/email-signup.tsx +++ b/apps/dashboard/app/auth/sign-up/email-signup.tsx @@ -20,8 +20,14 @@ export const EmailSignUp: React.FC = ({ setError, setVerification }) => { const [isLoading, setIsLoading] = React.useState(false); const [_transferLoading, setTransferLoading] = React.useState(true); const router = useRouter(); + + // biome-ignore lint/correctness/useExhaustiveDependencies: effect must be called once if sign-up is loaded React.useEffect(() => { const signUpFromParams = async () => { + if (!signUpLoaded) { + return; + } + const ticket = new URL(window.location.href).searchParams.get("__clerk_ticket"); const emailParam = new URL(window.location.href).searchParams.get("email"); if (!ticket && !emailParam) { @@ -68,6 +74,7 @@ export const EmailSignUp: React.FC = ({ setError, setVerification }) => { }); } }; + signUpFromParams(); setTransferLoading(false); }, [signUpLoaded]); From 49a860cf76c37c67981ed0915b24c4db6ca6c2cd Mon Sep 17 00:00:00 2001 From: unrenamed Date: Fri, 15 Nov 2024 15:44:46 +0200 Subject: [PATCH 2/2] fix: add missing dependency to sniny-card component --- apps/www/components/shiny-card.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/www/components/shiny-card.tsx b/apps/www/components/shiny-card.tsx index b7c8830773..93f4bd152f 100644 --- a/apps/www/components/shiny-card.tsx +++ b/apps/www/components/shiny-card.tsx @@ -60,7 +60,7 @@ export const ShinyCardGroup: React.FC = ({ }); } } - }, [mousePosition.x, mousePosition.y]); + }, [boxes, mousePosition.x, mousePosition.y]); useEffect(() => { onMouseMove();