/
githubmirror
/
ydb-embedded-ui
Обзор
Документация
Войти
/
githubmirror
/
ydb-embedded-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/utils/hooks/useCompactionFeature.ts
29 строк
1 KB
Hellen
feat: improve table compaction (#3967)
05 июн 2026, 15:28
Не верифицирован
05 июн 2026, 15:28
4665f40
Код
Авторство
О чём код?
import {useFeatureFlagsAvailable} from '../../store/reducers/capabilities/hooks'; import {configsApi} from '../../store/reducers/configs'; import {isForcedCompactionEnabled} from '../tableCompaction'; interface UseCompactionFeatureResult { compactionEnabled: boolean; isFeatureFlagsLoading: boolean; } /** * Hook for checking if table compaction feature is enabled. * Fetches feature flags and determines if forced compaction is available. * @param database - Database path * @param enabled - Whether to fetch feature flags (default: true). Set to false to skip the query. * @returns Compaction feature availability and loading state */ export function useCompactionFeature(database: string, enabled = true): UseCompactionFeatureResult { const featureFlagsAvailable = useFeatureFlagsAvailable(); const {currentData: featureFlags, isFetching: isFeatureFlagsLoading} = configsApi.useGetFeatureFlagsQuery({database}, {skip: !featureFlagsAvailable || !enabled}); const compactionEnabled = isForcedCompactionEnabled(featureFlags); return { compactionEnabled, isFeatureFlagsLoading, }; }