Skip to content

Commit 08c01f6

Browse files
committed
check if iframe using isLayoutEffect instead of isEffect
1 parent 47766e2 commit 08c01f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

components/donate/DonateWrapper.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import classNames from "classnames"
22
import Head from "next/head"
33
import Image from "next/image"
4-
import { useEffect, useState } from "react"
4+
import { useLayoutEffect, useState } from "react"
55

66
import { Theme } from "../../donate/types"
77
import { isInIframe } from "../../donate/utils"
@@ -25,7 +25,7 @@ export function DonateWrapper({
2525
// This is done this way to avoid hydration errors.
2626
// See: https://nextjs.org/docs/messages/react-hydration-error
2727
const [isClient, setIsClient] = useState(false)
28-
useEffect(() => {
28+
useLayoutEffect(() => {
2929
setIsClient(isInIframe())
3030
}, [])
3131

0 commit comments

Comments
 (0)