Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IUseFeatureFlagHookProps<KEYS, PROPS>

The set of arguments needed to manage feature flag state

Type parameters

  • KEYS: string

    the union of all possible feature flag keys. E.g. 'useV2ui' | 'useNewPaymentGateway' | ...

  • PROPS: string

    the union of all expected props on the user identifier object. E.g. 'organization' | 'email' | ...

Hierarchy

  • IUseFeatureFlagHookProps

Index

Properties

cacheKey?: string

the key to use when caching the flag configuration to localStorage. Defaults to DefaultFeatureFlagCacheKey

defaultValues?: Partial<Record<KEYS, boolean>>

The default values to use when any fetch operation fails if there is no cached copy of the flags. The order of fallbacks (in case of error or not present) is as follows:

  1. fetchFlags result
  2. localStorage cache
  3. defaultValues
flagKeys?: KEYS[]

a list of the feature flag keys to auto-populate with false if not present on the return value of the feature flag source

flagSource: IFeatureFlagSource<KEYS, PROPS>

the flag source to use to fetch the flag configuration

obfuscateCache?: boolean

Whether or not to obfuscate (via base64 encoding) the cached key & feature flags (and reduce the keys to only those that are true). This is useful when you don't want people to be immediately aware of the keys that you are using (or have available), but this is not a strong obfuscation as it's only base64.

refetchOnChange?: any[]

A list of values to watch and refetch the flags if changed, helpful if you have non-identifier changes that trigger a flag change. Calls to IFeatureFlagContext.identify will always trigger a refetch, so there is no need to use this if you are already re-calling identify

skip?: boolean

Skip refetching temporarily while this prop is true

Generated using TypeDoc