Skip to content

Commit

Permalink
Merge branch 'dev' into AGE-1414/improve-posthog-imports-to-reduce-in…
Browse files Browse the repository at this point in the history
…itial-bundle-size
  • Loading branch information
ardaerzin committed Dec 11, 2024
2 parents 69dc703 + 3483f08 commit d4d4ac9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions agenta-web/src/hooks/useIsomorphicLayoutEffect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {useLayoutEffect, useEffect} from "react"

// useIsomorphicLayoutEffect is a custom hook that uses useLayoutEffect on the client-side
// (when window is defined) and useEffect on the server-side (when window is undefined).
// This ensures that the code runs correctly in both client-side and server-side environments.
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect

export default useIsomorphicLayoutEffect

0 comments on commit d4d4ac9

Please sign in to comment.