core-api: refactor FeatureFlagApi to register flags instead of assigning
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import {
|
||||
featureFlagsApiRef,
|
||||
FeatureFlagsRegistryItem,
|
||||
FeatureFlag,
|
||||
FeatureFlagState,
|
||||
InfoCard,
|
||||
useApi,
|
||||
@@ -30,7 +30,7 @@ export const FeatureFlags = () => {
|
||||
const featureFlagsApi = useApi(featureFlagsApiRef);
|
||||
const featureFlags = featureFlagsApi.getRegisteredFlags();
|
||||
const initialFlagState = featureFlags.reduce(
|
||||
(result, featureFlag: FeatureFlagsRegistryItem) => {
|
||||
(result, featureFlag: FeatureFlag) => {
|
||||
const state = featureFlagsApi.getFlags().get(featureFlag.name);
|
||||
|
||||
result[featureFlag.name] = state;
|
||||
|
||||
@@ -22,10 +22,10 @@ import {
|
||||
Switch,
|
||||
Tooltip,
|
||||
} from '@material-ui/core';
|
||||
import { FeatureFlagsRegistryItem } from '@backstage/core';
|
||||
import { FeatureFlag } from '@backstage/core';
|
||||
|
||||
type Props = {
|
||||
flag: FeatureFlagsRegistryItem;
|
||||
flag: FeatureFlag;
|
||||
enabled: boolean;
|
||||
toggleHandler: Function;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user