MCPcopy
hub / github.com/codeaashu/claude-code / resetGrowthBook

Function resetGrowthBook

src/services/analytics/growthbook.ts:987–1010  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

985 * Reset GrowthBook client state (primarily for testing)
986 */
987export function resetGrowthBook(): void {
988 stopPeriodicGrowthBookRefresh()
989 // Remove process handlers before destroying client to prevent accumulation
990 if (currentBeforeExitHandler) {
991 process.off('beforeExit', currentBeforeExitHandler)
992 currentBeforeExitHandler = null
993 }
994 if (currentExitHandler) {
995 process.off('exit', currentExitHandler)
996 currentExitHandler = null
997 }
998 client?.destroy()
999 client = null
1000 clientCreatedWithAuth = false
1001 reinitializingPromise = null
1002 experimentDataByFeature.clear()
1003 pendingExposures.clear()
1004 loggedExposures.clear()
1005 remoteEvalFeatureValues.clear()
1006 getGrowthBookClient.cache?.clear?.()
1007 initializeGrowthBook.cache?.clear?.()
1008 envOverrides = null
1009 envOverridesParsed = false
1010}
1011
1012// Periodic refresh interval (matches Statsig's 6-hour interval)
1013const GROWTHBOOK_REFRESH_INTERVAL_MS =

Callers 3

showSetupScreensFunction · 0.85
growthbook.tsFile · 0.85

Calls 4

offMethod · 0.80
destroyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected