Skip to content

Commit

Permalink
Avoid accessing global at module initialization time.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayur Arora committed Aug 22, 2024
1 parent 83446e7 commit 581bd35
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import { ProfilerContext } from '../../profiler';
import type { Status } from './types';
import { useSubscription } from './utils';

const { requestIdleCallback = setTimeout } = window;

export function createComponentClient<C extends ComponentType<any>>({
defer,
deferred,
Expand All @@ -31,6 +29,7 @@ export function createComponentClient<C extends ComponentType<any>>({
dataLazyId: string;
moduleId: string;
}) {
const { requestIdleCallback = setTimeout } = window;
const ResolvedLazy = lazy(() => deferred.promise);

return (props: ComponentProps<C>) => {
Expand Down

0 comments on commit 581bd35

Please sign in to comment.