Files
supabase/apps/studio/data/api-keys
Alaister YoungandAlaister Young 8f75187422 fix(studio): stop dev No queryFn error from grantedQueryOptions (#54004)
Fixes TanStack Query spamming `No queryFn was passed as an option` in
dev whenever a grant-gated query renders without a grant or required
variable (such as `branchesQueryOptions` when `projectRef` is
`undefined`).

**Changed:**

- Replaced `queryFn: undefined` in `grantedQueryOptions` with a stable
`fallbackQueryFn` while keeping `enabled: false`. This satisfies
`useBaseQuery`'s dev-mode check and still delegates to a subscribed
granted observer on invalidation (avoiding the `skipToken` shared-cache
regression from #53088).
- Updated `granted-query-options.test.ts` and `api-keys-query.test.tsx`
to verify no `console.error` is logged when rendering without a grant or
`projectRef` and that invalidation still refetches via the granted
observer.
- Updated the `studio-queries` skill note to match.

## To test

- Run `pnpm dev:studio` and open a non-branch project's home page.
Confirm the browser console and dev terminal no longer spam
`[["projects",null,"branches"]]: No queryFn was passed as an option`.
- Open Project Settings -> API Keys, create or delete a key, and confirm
the list still refreshes cleanly.
- Run `pnpm --filter studio test data/granted-query-options.test.ts
data/api-keys/api-keys-query.test.tsx`.

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-26 01:01:33 +08:00
..
2025-10-30 17:07:07 +00:00