Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(frontend): remove redundant useOnMountEffect documentation (#100078)

Paul D'Ambra996c01dc78a5
diff --git a/frontend/src/lib/hooks/useOnMountEffect.ts b/frontend/src/lib/hooks/useOnMountEffect.ts
index d9ab12e0992c..29ed0b3db800 100644
--- a/frontend/src/lib/hooks/useOnMountEffect.ts
+++ b/frontend/src/lib/hooks/useOnMountEffect.ts
@@ -1,35 +1,6 @@
import React, { useEffect } from 'react'
-/**
- * useOnMountEffect - A hook that runs an effect only once when the component mounts
- *
- * This is a wrapper around useEffect with an empty dependency array, making the intent
- * explicit that the effect should only run once on mount. This pattern is common enough
- * that having a dedicated hook improves code readability and intent.
- *
- * Why this exists:
- * - Makes the "run once on mount" intent explicit in the function name
- * - Avoids repetitive empty dependency arrays throughout the codebase
- * - Centralizes the oxlint disable comment for the exhaustive-deps rule
- *
- * Usage:
- * ```tsx
- * useOnMountEffect(() => {
- * // This code runs only once when component mounts
- * fetchData()
- * setupEventListeners()
- *
- * return () => {
- * // Cleanup code (optional)
- * removeEventListeners()
- * }
- * })
- * ```
- *
- * Note: The oxlint disable is intentional - we specifically want an empty dependency
- * array here to ensure the effect only runs once on mount, despite what the
- * exhaustive-deps rule suggests.
- */
+/** Runs an effect that intentionally uses values from the initial render only. */
export function useOnMountEffect(effect: React.EffectCallback): void {
useEffect(effect, []) // oxlint-disable-line react-hooks/exhaustive-deps
}