...
Inside
FeatureFlagKey.java
, add the enum value representing the Feature Flag.If not done already, inject FeatureFlagConfig inside the class where the Feature Flag will be used.
Apply conditional statements referencing the enum value to use the feature flag.
Code Block if (featureFlagConfig.isFeatureEnabled(FeatureFlagKey.PROVENANCE_V2_VISUALIZATION.getKey()){}
Applying Feature Flag in
...
synapse-react-client
Info |
---|
Make sure that the feature flag is already created inside the Synapse-Stack-Builder |
SRC utilizes react-query library and Applications using synapse-react-client will fetch the configuration from the SWC servlet to retrieve feature flags from AWS AppConfig. React components utilize react-query to retrieve and cache the configuration within the React application’s lifecycle.
The steps to apply feature flags inside SRC are as followedfollows:
Inside
FeatureFlags.ts
under synapse-types, add an enum value representing the Feature Flag.Build synapse-types using
pnpm
or command under package.jsonNavigate to the file where the feature flag will be used and add imports
Code Block import { useGetFeatureFlag } from '../../../../synapse-queries' import { FeatureFlagEnum } from '@sage-bionetworks/synapse-types'
Apply conditional statements referencing the enum value to use the feature flag.
Code Block useGetFeatureFlag(FeatureFlagEnum.DESCRIPTION_FIELD)
Validation Process
Add your stack to the list of Storybook stacks.
In
packages/synapse-react-client/src/utils/functions/getEndpoint.ts
, add a stack to theSTACK_MAP
and use the endpoints for your dev stack (Reference the validation process for applying feature flag in SWC) or prod/staging/dev stack with the wanted configurations inside AWS AppConfig.Then in
packages/synapse-react-client/.storybook/preview.tsx
you can add it so you can pick that stack in Storybook (L94)
...