diff --git a/landing/keyservers.react.js b/landing/keyservers.react.js --- a/landing/keyservers.react.js +++ b/landing/keyservers.react.js @@ -3,14 +3,13 @@ import { create } from '@lottiefiles/lottie-interactivity'; import * as React from 'react'; +import { useIsomorphicLayoutEffect } from 'lib/hooks/useIsomorphicLayoutEffect.react'; + import { assetsCacheURLPrefix } from './asset-meta-data'; import css from './keyservers.css'; import ReadDocsButton from './read-docs-btn.react'; import StarBackground from './star-background.react'; -const useIsomorphicLayoutEffect = - typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect; - function Keyservers(): React.Node { React.useEffect(() => { import('@lottiefiles/lottie-player'); diff --git a/web/components/menu.react.js b/web/components/menu.react.js --- a/web/components/menu.react.js +++ b/web/components/menu.react.js @@ -3,6 +3,8 @@ import classnames from 'classnames'; import * as React from 'react'; +import { useIsomorphicLayoutEffect } from 'lib/hooks/useIsomorphicLayoutEffect.react'; + import { useRenderMenu } from '../menu-provider.react'; import css from './menu.css'; @@ -60,7 +62,7 @@ // useLayoutEffect is necessary so that the menu position is immediately // updated in the first render of component - React.useLayoutEffect(() => { + useIsomorphicLayoutEffect(() => { updatePosition(); }, [updatePosition]);