useShowMultigresLogs.ts24 lines · main
1import { useFlag } from 'common'
2
3import { useIsHighAvailability } from './useSelectedProject'
4
5/**
6 * Whether to surface the Multigres logs collection (sidebar, page, and Field
7 * Reference source).
8 *
9 * Gated on both:
10 * - the `multigresLogs` feature flag, so rollout is decoupled from HA status
11 * and the feature ships dark until explicitly enabled, and
12 * - the project's `high_availability` flag, since Multigres only runs on HA
13 * projects.
14 *
15 * Note: `high_availability` is an existing product feature that predates
16 * Multigres, so the flag is required to avoid showing a broken collection to
17 * existing HA projects that don't have a `multigres_logs` table.
18 */
19export const useShowMultigresLogs = () => {
20 const multigresLogsEnabled = useFlag('multigresLogs')
21 const isHighAvailability = useIsHighAvailability()
22
23 return multigresLogsEnabled && isHighAvailability
24}