MCPcopy Create free account
hub / github.com/codeaashu/claude-code / setGrowthBookConfigOverride

Function setGrowthBookConfigOverride

src/services/analytics/growthbook.ts:245–271  ·  view source on GitHub ↗
(
  feature: string,
  value: unknown,
)

Source from the content-addressed store, hash-verified

243 * change the model until the next periodic refresh.
244 */
245export function setGrowthBookConfigOverride(
246 feature: string,
247 value: unknown,
248): void {
249 if (process.env.USER_TYPE !== 'ant') return
250 try {
251 saveGlobalConfig(c => {
252 const current = c.growthBookOverrides ?? {}
253 if (value === undefined) {
254 if (!(feature in current)) return c
255 const { [feature]: _, ...rest } = current
256 if (Object.keys(rest).length === 0) {
257 const { growthBookOverrides: __, ...configWithout } = c
258 return configWithout
259 }
260 return { ...c, growthBookOverrides: rest }
261 }
262 if (isEqual(current[feature], value)) return c
263 return { ...c, growthBookOverrides: { ...current, [feature]: value } }
264 })
265 // Subscribers do their own change detection (see onGrowthBookRefresh docs),
266 // so firing on a no-op write is fine.
267 refreshed.emit()
268 } catch (e) {
269 logError(e)
270 }
271}
272
273export function clearGrowthBookConfigOverrides(): void {
274 if (process.env.USER_TYPE !== 'ant') return

Callers

nothing calls this directly

Calls 4

saveGlobalConfigFunction · 0.85
keysMethod · 0.80
emitMethod · 0.80
logErrorFunction · 0.50

Tested by

no test coverage detected