Skip to content

Commit

Permalink
init (#986)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aslemammad authored Mar 6, 2024
1 parent d1d3cf7 commit 605e458
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/react-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
memo,
useCallback,
useEffect,
useLayoutEffect,
useLayoutEffect as uLE,
useRef,
useState,
} from 'react';
Expand All @@ -32,6 +32,7 @@ import { experimental_options } from '../experimental';
import { useContainer, useNearestParent } from '../react/its-fine';
import { useSSRSafeId } from './utils';

const useLayoutEffect = typeof window === 'undefined' ? useEffect : uLE;
let globalInfo;

export const block = <P extends MillionProps>(
Expand Down
5 changes: 2 additions & 3 deletions packages/react/its-fine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@
import {
useRef,
useState,
useMemo,
createElement,
useEffect,
useLayoutEffect as uLE,
} from 'react';
import type ReactReconciler from 'react-reconciler';

// avoid hydration errors in server
const useLayoutEffect = typeof window === 'undefined' ? () => {} : uLE;
const useLayoutEffect = typeof window === 'undefined' ? useEffect : uLE;

/**
* Represents a react-internal Fiber node.
Expand Down

0 comments on commit 605e458

Please sign in to comment.