From 7c8b7fa0c46b6efaee9f817238fddea620fd4c76 Mon Sep 17 00:00:00 2001 From: James P Date: Tue, 10 Dec 2024 12:24:40 -0500 Subject: [PATCH 1/2] chore: Update footer.tsx (#2735) * Update footer.tsx Add status page --- .../src/workflows/count_keys_per_keyspace.ts | 29 ++++++++++--------- apps/www/components/footer/footer.tsx | 5 ++++ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/apps/workflows/src/workflows/count_keys_per_keyspace.ts b/apps/workflows/src/workflows/count_keys_per_keyspace.ts index d1134aba59..906191b9ca 100644 --- a/apps/workflows/src/workflows/count_keys_per_keyspace.ts +++ b/apps/workflows/src/workflows/count_keys_per_keyspace.ts @@ -18,7 +18,6 @@ export class CountKeys extends WorkflowEntrypoint { password: this.env.DATABASE_PASSWORD, }); - await step.do("fetch keyspaces", async () => { const keySpaces = await db.query.keyAuth.findMany({ where: (table, { or, and, isNull, lt }) => @@ -32,18 +31,22 @@ export class CountKeys extends WorkflowEntrypoint { console.info(`found ${keySpaces.length} key spaces`); for (const keySpace of keySpaces) { - const rows = await step.do(`count keys for ${keySpace.id} `, async () => db - .select({ count: count() }) - .from(schema.keys) - .where(and(eq(schema.keys.keyAuthId, keySpace.id), isNull(schema.keys.deletedAt)))) - - await step.do(`update ${keySpace.id}`, async () => db - .update(schema.keyAuth) - .set({ - sizeApprox: rows.at(0)?.count ?? 0, - sizeLastUpdatedAt: Date.now(), - }) - .where(eq(schema.keyAuth.id, keySpace.id))) + const rows = await step.do(`count keys for ${keySpace.id} `, async () => + db + .select({ count: count() }) + .from(schema.keys) + .where(and(eq(schema.keys.keyAuthId, keySpace.id), isNull(schema.keys.deletedAt))), + ); + + await step.do(`update ${keySpace.id}`, async () => + db + .update(schema.keyAuth) + .set({ + sizeApprox: rows.at(0)?.count ?? 0, + sizeLastUpdatedAt: Date.now(), + }) + .where(eq(schema.keyAuth.id, keySpace.id)), + ); } // this just prints on the cf dashboard, we don't use the return value return { keySpaces: keySpaces.length }; diff --git a/apps/www/components/footer/footer.tsx b/apps/www/components/footer/footer.tsx index 239720895d..b36d4388da 100644 --- a/apps/www/components/footer/footer.tsx +++ b/apps/www/components/footer/footer.tsx @@ -37,6 +37,11 @@ const navigation = [ title: "Glossary", href: "/glossary", }, + { + title: "Status Page", + href: "https://status.unkey.com", + external: true, + }, ], }, { From ab96ba8611f5d3a9e6d0cbd1ddcfe97bf0361c5f Mon Sep 17 00:00:00 2001 From: Nazar Poshtarenko <32395926+unrenamed@users.noreply.github.com> Date: Tue, 10 Dec 2024 19:38:10 +0200 Subject: [PATCH 2/2] fix: resolve 15 of 16 remaining lint warnings (#2662) * fix: add biome-ignore to hooks that work as expected * fix: add missing dependency to sniny-card component --------- Co-authored-by: Andreas Thomas --- .../(app)/apis/[apiId]/keys/[keyAuthId]/new/client.tsx | 2 +- .../dashboard/app/(app)/settings/root-keys/new/client.tsx | 2 +- apps/dashboard/app/auth/sign-in/email-signin.tsx | 5 +++-- apps/dashboard/app/auth/sign-up/email-signup.tsx | 8 +++++++- apps/www/components/shiny-card.tsx | 2 +- 5 files changed, 13 insertions(+), 6 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 ac39d56f38..6b4eb46b2c 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 @@ -149,7 +149,7 @@ export const CreateKey = ({ apiId, keyAuthId, defaultBytes, defaultPrefix }: Pro form.resetField("limit", undefined); }; - // biome-ignore lint: only run once + // 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 c74be97650..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,7 +93,7 @@ export const Client: React.FC = ({ apis }) => { })); }; - // biome-ignore lint: should only run once + // 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 f3f4fe583d..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-ignore 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 a75efc945b..2fbc4d40f9 100644 --- a/apps/dashboard/app/auth/sign-up/email-signup.tsx +++ b/apps/dashboard/app/auth/sign-up/email-signup.tsx @@ -20,9 +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: works fine as is + + // 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) { @@ -69,6 +74,7 @@ export const EmailSignUp: React.FC = ({ setError, setVerification }) => { }); } }; + signUpFromParams(); setTransferLoading(false); }, [signUpLoaded]); diff --git a/apps/www/components/shiny-card.tsx b/apps/www/components/shiny-card.tsx index 7450e7a71f..2f7b42d608 100644 --- a/apps/www/components/shiny-card.tsx +++ b/apps/www/components/shiny-card.tsx @@ -61,7 +61,7 @@ export const ShinyCardGroup: React.FC = ({ }); } } - }, [mousePosition.x, mousePosition.y]); + }, [boxes, mousePosition.x, mousePosition.y]); useEffect(() => { onMouseMove();