From a4b60167574bfa595e5b2e03d1aef8f509fc8e2e Mon Sep 17 00:00:00 2001 From: Alaister Young <10985857+alaister@users.noreply.github.com> Date: Wed, 27 May 2026 22:31:27 +0800 Subject: [PATCH] fix(studio): catch TanStack-side typechecks up with master + TS6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A bunch of master changes landed during the merge that needed follow-ups on the TanStack side: - Pin @tanstack/react-query to ~5.83.0 (and devtools to ~5.90.2) in apps/studio and apps/ui-library. A previous master merge had bumped these to ^5.100.10, which changed mutation onSuccess/onError to require a 4th MutationFunctionContext arg and broke every studio mutation hook still using the 3-arg shape (~570 call sites). - Cast WebCrypto inputs to BufferSource in lib/role-impersonation.ts, lib/ai/util.ts, lib/telemetry.tsx — TS6's DOM lib tightened Uint8Array's generic so encoder.encode() no longer matches BufferSource without a hint. - compat/next/script.tsx: omit `onLoad`/`onError` from the React script attrs we extend so our DOM-flavoured callback signatures don't clash with React's SyntheticEvent handlers. - compat/next/link.tsx + compat/next/navigation.ts: TanStack Router type tightening — cast `search` and `{strict: false}` since the new ParamsReducerFn / UseParamsOptions shapes don't fit the Next-shaped arguments we pass through. - router.tsx: cast the QueryClient handed to setupRouterSsrQueryIntegration. react-router-ssr-query pulls in query-core@5.100 as a peer; we pin react-query to 5.83. The runtime class is identical, but TS treats the two as nominally distinct because of #private fields. - Mirror master's page-shape changes on the route shells: drop dehydratedState passthroughs for pages that no longer accept it (functions/code, functions/new, integrations/github/authorize, org.[_], project.[_]); add them back via the wrapper pattern for pages that do still require it (redeem, aws-marketplace-onboarding, sql/examples, stripe/projects/login). - routes/__root.tsx: rename unused `info` to `_info` to satisfy noUnusedParameters. - packages/ui AnimatedCounter / Space / Typography: drop the unused `import React from 'react'` (TS6 noUnusedLocals). - scripts/ratchet-eslint-rules.ts: bump child_process maxBuffer from 32MB to 128MB so local runs don't truncate the ESLint JSON payload. --- apps/studio/compat/next/api.ts | 7 +- apps/studio/compat/next/link.tsx | 6 +- apps/studio/compat/next/navigation.ts | 3 +- apps/studio/compat/next/script.tsx | 6 +- apps/studio/lib/ai/util.ts | 2 +- apps/studio/lib/role-impersonation.ts | 4 +- apps/studio/lib/telemetry.tsx | 2 +- apps/studio/package.json | 4 +- apps/studio/router.tsx | 7 +- apps/studio/routes/__root.tsx | 2 +- .../_auth/partners/stripe/projects/login.tsx | 2 +- .../routes/aws-marketplace-onboarding.tsx | 6 +- .../routes/integrations/github/authorize.tsx | 2 +- apps/studio/routes/org.[_].$.tsx | 2 +- apps/studio/routes/org.[_].tsx | 2 +- apps/studio/routes/project.[_].$.tsx | 2 +- apps/studio/routes/project.[_].tsx | 2 +- .../$ref/functions/$functionSlug/code.tsx | 2 +- .../routes/project/$ref/functions/new.tsx | 2 +- .../routes/project/$ref/sql/examples.tsx | 6 +- apps/studio/routes/redeem.tsx | 6 +- apps/studio/scripts/ratchet-eslint-rules.ts | 2 +- apps/ui-library/package.json | 2 +- .../AnimatedCounter/AnimatedCounter.tsx | 2 +- packages/ui/src/components/Space/Space.tsx | 2 - .../src/components/Typography/Typography.tsx | 2 - pnpm-lock.yaml | 75 +++++++++++-------- 27 files changed, 100 insertions(+), 62 deletions(-) diff --git a/apps/studio/compat/next/api.ts b/apps/studio/compat/next/api.ts index 13a75d368af..dd6001878f6 100644 --- a/apps/studio/compat/next/api.ts +++ b/apps/studio/compat/next/api.ts @@ -238,7 +238,12 @@ function buildResponse() { // We honour `statusCode` and `headers`; `statusMessage` is dropped // (Fetch `Response` doesn't preserve a custom HTTP/1 reason phrase // when running through TanStack's runtime). - ;(res as unknown as { writeHead: (...args: unknown[]) => unknown }).writeHead = ( + type WriteHead = ( + code: number, + headersOrMessage?: string | Record, + maybeHeaders?: Record + ) => unknown + ;(res as unknown as { writeHead: WriteHead }).writeHead = ( code: number, headersOrMessage?: string | Record, maybeHeaders?: Record diff --git a/apps/studio/compat/next/link.tsx b/apps/studio/compat/next/link.tsx index c481bad49c9..c662e623466 100644 --- a/apps/studio/compat/next/link.tsx +++ b/apps/studio/compat/next/link.tsx @@ -197,7 +197,8 @@ const Link = forwardRef(function Link( , 'children'> { +interface ScriptProps extends Omit< + ComponentPropsWithoutRef<'script'>, + 'children' | 'onLoad' | 'onError' +> { // Accepted-and-dropped in this shim — the browser handles network // priority via the regular `