mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
Feature enhancement — smarter incident banner targeting logic ## What is the current behavior? Displaying the incident banner requires toggling a flag or environment variable. Banners are shown to all users regardless of whether their projects are in affected regions or whether the incident affects project creation. ## What is the new behavior? Banner visibility is now driven by `show_banner` metadata from the StatusPage API — no manual flag or env var toggle needed. Per-user targeting is then applied: - Users with projects only see the banner when they have a database in an affected region - Users without projects only see the banner when the incident affects project creation Incident responses are enriched with cache data (`affected_regions`, `affects_project_creation`) fetched from a Supabase table. Visibility logic is extracted into a dedicated hook and pure utility function, backed by unit tests. ## Additional context Resolves FE-2562
43 lines
1.9 KiB
TypeScript
43 lines
1.9 KiB
TypeScript
export const INFINITE_PROJECTS_KEY_PREFIX = 'all-projects-infinite'
|
|
|
|
export const projectKeys = {
|
|
infiniteList: (params?: {
|
|
limit: number
|
|
sort?: 'name_asc' | 'name_desc' | 'created_asc' | 'created_desc'
|
|
search?: string
|
|
}) => [INFINITE_PROJECTS_KEY_PREFIX, params].filter(Boolean),
|
|
infiniteListByOrg: (
|
|
slug: string | undefined,
|
|
params?: {
|
|
limit: number
|
|
sort?: 'name_asc' | 'name_desc' | 'created_asc' | 'created_desc'
|
|
search?: string
|
|
statuses?: string[]
|
|
}
|
|
) => [INFINITE_PROJECTS_KEY_PREFIX, slug, params].filter(Boolean),
|
|
status: (projectRef: string | undefined) => ['project', projectRef, 'status'] as const,
|
|
types: (projectRef: string | undefined) => ['project', projectRef, 'types'] as const,
|
|
detail: (projectRef: string | undefined) => ['project', projectRef, 'detail'] as const,
|
|
serviceVersions: (projectRef: string | undefined) =>
|
|
['project', projectRef, 'service-versions'] as const,
|
|
readonlyStatus: (projectRef: string | undefined) =>
|
|
['projects', projectRef, 'readonly-status'] as const,
|
|
projectTransfer: (projectRef: string | undefined, targetOrganizationSlug: string | undefined) =>
|
|
['projects', 'transfer', projectRef, targetOrganizationSlug] as const,
|
|
projectTransferPreview: (
|
|
projectRef: string | undefined,
|
|
targetOrganizationSlug: string | undefined
|
|
) => ['projects', 'transfer', projectRef, targetOrganizationSlug, 'preview'] as const,
|
|
pauseStatus: (projectRef: string | undefined) =>
|
|
['projects', projectRef, 'pause-status'] as const,
|
|
|
|
// Clone to new project
|
|
listCloneBackups: (projectRef: string | undefined) =>
|
|
['projects', projectRef, 'clone-backups'] as const,
|
|
listCloneStatus: (projectRef: string | undefined) =>
|
|
['projects', projectRef, 'clone-status'] as const,
|
|
|
|
// Banner-specific: first-page snapshot used by the status page banner hook
|
|
bannerProjectsByOrg: (slug: string) => ['banner', 'org-projects', slug] as const,
|
|
}
|