mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
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>