mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 06:09:08 +03:00
## Problem Health Advisor results appear on the project homepage whenever the main `healthAdvisor` flag is enabled, so the homepage cannot be rolled out separately. The existing gates also contain redundant boolean and platform checks. ## Fix Require both `healthAdvisor` and `healthAdvisorInHomepage` before fetching or displaying health advisories on the homepage. Simplify all Health Advisor gates to use the boolean ConfigCat flag directly, including the cleanup requested in the review of #50326. ## How to test - Enable only `healthAdvisor` and verify Health Advisor remains available outside the homepage while health results do not appear or load on the homepage. - Enable both flags and verify health results appear on the homepage. - Disable `healthAdvisor` and verify Health Advisor remains unavailable everywhere. - Existing targeted tests pass: 5 tests across Advisor menu and panel integration suites. - Prettier and whitespace checks pass. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Health Advisor is now available in non-platform environments when enabled. * Navigation, filtering, lint checks, and project pages consistently follow the Health Advisor feature setting. * Self-hosted environments can use the Health Advisor category. * **Bug Fixes** * Homepage Health Advisor visibility now follows both the Health Advisor and homepage-specific settings. * Updated empty states and health lint results to match the configured availability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { useFlag, useParams } from 'common'
|
|
import type { CommandOptions } from 'ui-patterns/CommandMenu'
|
|
import { useRegisterCommands } from 'ui-patterns/CommandMenu'
|
|
import type { IRouteCommand } from 'ui-patterns/CommandMenu/internal/types'
|
|
|
|
import { COMMAND_MENU_SECTIONS } from '@/components/interfaces/App/CommandMenu/CommandMenu.utils'
|
|
|
|
export function useAdvisorsGoToCommands(options?: CommandOptions) {
|
|
let { ref } = useParams()
|
|
ref ||= '_'
|
|
const isHealthAdvisorEnabled = useFlag('healthAdvisor')
|
|
|
|
useRegisterCommands(
|
|
COMMAND_MENU_SECTIONS.NAVIGATE,
|
|
[
|
|
...(isHealthAdvisorEnabled
|
|
? [
|
|
{
|
|
id: 'nav-advisors-health',
|
|
name: 'Health Advisor',
|
|
route: `/project/${ref}/advisors/health`,
|
|
defaultHidden: true,
|
|
} satisfies IRouteCommand,
|
|
]
|
|
: []),
|
|
{
|
|
id: 'nav-advisors-security',
|
|
name: 'Security Advisor',
|
|
route: `/project/${ref}/advisors/security`,
|
|
defaultHidden: true,
|
|
},
|
|
{
|
|
id: 'nav-advisors-performance',
|
|
name: 'Performance Advisor',
|
|
route: `/project/${ref}/advisors/performance`,
|
|
defaultHidden: true,
|
|
},
|
|
],
|
|
{ ...options, deps: [ref, isHealthAdvisorEnabled] }
|
|
)
|
|
}
|