perf: fold feature wall telemetry cleanup into open effect (#4177)

This commit is contained in:
Neil
2026-05-31 07:02:24 -07:00
committed by GitHub
parent 000e995303
commit aa19a82cda
@@ -100,18 +100,18 @@ export function useFeatureWallTourTelemetry(args: {
}, [])
useEffect(() => {
if (isOpen && openFeatureWallTourTelemetrySession(telemetryRef.current, performance.now())) {
track('feature_wall_opened', { source })
return
}
if (!isOpen) {
emitCloseTelemetry()
return undefined
}
}, [emitCloseTelemetry, isOpen, source])
useEffect(() => {
if (openFeatureWallTourTelemetrySession(telemetryRef.current, performance.now())) {
track('feature_wall_opened', { source: sourceRef.current })
}
// Why: the telemetry session opens from this Effect, so the same Effect
// owns close-on-unmount instead of a second cleanup-only Effect.
return () => emitCloseTelemetry()
}, [emitCloseTelemetry])
}, [emitCloseTelemetry, isOpen])
return { markExitAction }
}