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

Function onGrowthBookRefresh

src/services/analytics/growthbook.ts:139–157  ·  view source on GitHub ↗
(
  listener: GrowthBookRefreshListener,
)

Source from the content-addressed store, hash-verified

137 * use isEqual against your last-seen config to decide whether to act.
138 */
139export function onGrowthBookRefresh(
140 listener: GrowthBookRefreshListener,
141): () => void {
142 let subscribed = true
143 const unsubscribe = refreshed.subscribe(() => callSafe(listener))
144 if (remoteEvalFeatureValues.size > 0) {
145 queueMicrotask(() => {
146 // Re-check: listener may have been removed, or resetGrowthBook may have
147 // cleared the Map, between registration and this microtask running.
148 if (subscribed && remoteEvalFeatureValues.size > 0) {
149 callSafe(listener)
150 }
151 })
152 }
153 return () => {
154 subscribed = false
155 unsubscribe()
156 }
157}
158
159/**
160 * Parse env var overrides for GrowthBook features.

Callers 2

useSkillsChangeFunction · 0.85
useMainLoopModelFunction · 0.85

Calls 1

callSafeFunction · 0.85

Tested by

no test coverage detected