Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kristiehuang committed Oct 10, 2023
1 parent 42079dd commit f5dd349
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
9 changes: 7 additions & 2 deletions src/dev/DevFlagsBox.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { BaseVariant, FeatureFlag, featureFlagSettings as featureFlagSettingsAtom, dynamicConfigSettings as dynamicConfigSettingsAtom } from 'featureFlags'
import {
BaseVariant,
dynamicConfigSettings as dynamicConfigSettingsAtom,
FeatureFlag,
featureFlagSettings as featureFlagSettingsAtom,
} from 'featureFlags'
import { DynamicConfigName, useDynamicConfig } from 'featureFlags/dynamicConfig'
import { useAtomValue } from 'jotai/utils'
import { useMemo, useState } from 'react'
Expand Down Expand Up @@ -64,7 +69,7 @@ export default function DevFlagsBox() {
const dynamicConfigs = useMemo(() => Object.values(DynamicConfigName), [])

const overrides = featureFlags.map((flagName) => Gate(flagName, featureFlagsAtom))
dynamicConfigs.forEach((configName) => { overrides.push(Config(configName, dynamicConfigsAtom)) })
dynamicConfigs.forEach((configName) => overrides.push(Config(configName, dynamicConfigsAtom)))

const hasOverrides = overrides.some((g) => g !== null)

Expand Down
11 changes: 5 additions & 6 deletions src/featureFlags/dynamicConfig/quickRouteChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import { DynamicConfigName, useDynamicConfig } from '.'
export function useQuickRouteChains(): ChainId[] {
const statsigConfig = useDynamicConfig(DynamicConfigName.quickRouteChains)
const featureFlagsContext = useFeatureFlagsContext()
let chains = statsigConfig.get(DynamicConfigName.quickRouteChains, []) as ChainId[]

const modalSettings = featureFlagsContext.configs[DynamicConfigName.quickRouteChains]
if (modalSettings) {
const modalSetChains = modalSettings[DynamicConfigName.quickRouteChains]
if (Array.isArray(modalSetChains) && modalSetChains !== chains) chains = modalSetChains
}
const remoteConfigChains = statsigConfig.get(DynamicConfigName.quickRouteChains, []) as ChainId[]
const localConfigChains =
featureFlagsContext.configs[DynamicConfigName.quickRouteChains]?.[DynamicConfigName.quickRouteChains]

const chains = Array.isArray(localConfigChains) ? localConfigChains : remoteConfigChains
if (chains.every((c) => Object.values(ChainId).includes(c))) {
return chains
} else {
Expand Down

0 comments on commit f5dd349

Please sign in to comment.