mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
<!-- ccr-slack-attribution --> _Requested by **Ivan Vasilov** · [Slack thread](https://supabase.slack.com/archives/C0161K73J1J/p1787296019236949?thread_ts=1787296019.236949&cid=C0161K73J1J)_ ## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Chore / feature-flag cleanup. ## What is the current behavior? The "Sign in with ChatGPT" button on `/sign-in` and `/sign-up` sits behind three gates in `useEnabledIdentityProviders`: 1. the static `dashboard_auth:sign_in_with_chatgpt` feature flag, AND 2. either the `ShowSignInWithChatGptButton` ConfigCat flag, OR 3. the `SIGN_IN_CHATGPT_ENABLED` (`siwc-enabled`) localStorage opt-in, flipped by a shareable `?siwc-enabled=1` link via `useSiwcQueryParamOptIn`. The ConfigCat flag resolves client-side, so on a fresh load the button is absent for the first render and appears once the flag comes back. That pushes the rest of the sign-in options down and produces a visible layout shift on the sign-in page. ## What is the new behavior? ChatGPT is gated only by its static `dashboard_auth:sign_in_with_chatgpt` feature flag, which is resolved synchronously from `enabled-features.json`. The button renders on the first paint, with no async re-layout. Removed: - the `useFlag('ShowSignInWithChatGptButton')` call and the `chatgptLocalStorageEnabled || chatGptConfigCatFlagEnabled` branch in `apps/studio/hooks/misc/useEnabledIdentityProviders.ts` - `LOCAL_STORAGE_KEYS.SIGN_IN_CHATGPT_ENABLED` and its `LOCAL_STORAGE_KEYS_ALLOWLIST` entry in `packages/common/constants/local-storage.ts` - `apps/studio/hooks/misc/useSiwcQueryParamOptIn.ts` and its callers in `pages/sign-in.tsx` / `pages/sign-up.tsx` — its only job was writing that localStorage flag - the tests that covered the two removed rollout gates The static `dashboard_auth:sign_in_with_chatgpt` kill switch is untouched. ## Additional context The `ShowSignInWithChatGptButton` ConfigCat flag is reported as 100% enabled (per Joshen Lim in the linked thread). The repo contains no default value, allowlist, or env gate for it — the live value lives only in ConfigCat, so that number is not verifiable from here. Once this merges the flag is unreferenced and should be **archived in ConfigCat by a human**; nothing in ConfigCat was changed as part of this PR. Verification notes: `packages/common` typechecks clean (`tsc --noEmit`) and all touched files pass the repo's Prettier config. Studio's `typecheck`, `lint`, and `vitest` could not be run here — `pnpm install` fails in this environment because `npm.jsr.io` (needed for studio's `@std/path` dependency) is not reachable through the network allowlist, so `apps/studio/node_modules` was never installed. CI should be treated as the first real run of those checks. --- _Generated by [Claude Code](https://claude.ai/code/session_01M21SPvwf6FSthomX4Lj3ZC)_ Co-authored-by: Claude <noreply@anthropic.com>
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import { useMemo } from 'react'
|
|
|
|
import { useIsFeatureEnabled } from './useIsFeatureEnabled'
|
|
import {
|
|
CHATGPT_IDENTITY_PROVIDER,
|
|
GITHUB_IDENTITY_PROVIDER,
|
|
type ExternalIdentityProviderConfig,
|
|
} from '@/lib/external-identity-providers'
|
|
|
|
/**
|
|
* Returns the statically-declared identity providers whose feature flag is currently enabled.
|
|
* To add a provider: declare its config in `lib/external-identity-providers.ts`, add a
|
|
* `dashboard_auth:sign_in_with_*` flag, and gate it here.
|
|
*/
|
|
export function useEnabledIdentityProviders(): ExternalIdentityProviderConfig[] {
|
|
const {
|
|
dashboardAuthSignInWithGithub: githubEnabled,
|
|
dashboardAuthSignInWithChatgpt: chatgptEnabled,
|
|
} = useIsFeatureEnabled([
|
|
'dashboard_auth:sign_in_with_github',
|
|
'dashboard_auth:sign_in_with_chatgpt',
|
|
])
|
|
|
|
return useMemo(
|
|
() =>
|
|
[
|
|
githubEnabled && GITHUB_IDENTITY_PROVIDER,
|
|
chatgptEnabled && CHATGPT_IDENTITY_PROVIDER,
|
|
].filter((p): p is ExternalIdentityProviderConfig => Boolean(p)),
|
|
[githubEnabled, chatgptEnabled]
|
|
)
|
|
}
|