remotion
Advanced tools
Comparing version 4.0.270 to 4.0.271
@@ -40,2 +40,3 @@ "use strict"; | ||
componentName: 'Composition', | ||
noSuspense: false, | ||
}); | ||
@@ -42,0 +43,0 @@ const nonce = (0, nonce_js_1.useNonce)(); |
@@ -31,5 +31,6 @@ import { type CompProps } from './Composition.js'; | ||
readonly useMediaMutedState: () => readonly [boolean, (u: React.SetStateAction<boolean>) => void]; | ||
readonly useLazyComponent: <Props>({ compProps, componentName, }: { | ||
readonly useLazyComponent: <Props>({ compProps, componentName, noSuspense, }: { | ||
compProps: CompProps<Props>; | ||
componentName: string; | ||
noSuspense: boolean; | ||
}) => import("react").ExoticComponent<Props | (import("react").PropsWithoutRef<Props> & import("react").RefAttributes<import("react").Component<Props, any, any>>)> & { | ||
@@ -36,0 +37,0 @@ readonly _result: import("react").ComponentType<Props>; |
@@ -6,6 +6,7 @@ import type { ComponentPropsWithRef, ComponentType, ExoticComponent } from 'react'; | ||
}; | ||
export declare const useLazyComponent: <Props>({ compProps, componentName, }: { | ||
export declare const useLazyComponent: <Props>({ compProps, componentName, noSuspense, }: { | ||
compProps: CompProps<Props>; | ||
componentName: string; | ||
noSuspense: boolean; | ||
}) => LazyExoticComponent<ComponentType<Props>>; | ||
export {}; |
@@ -29,14 +29,7 @@ "use strict"; | ||
// Expected, it can be any component props | ||
const useLazyComponent = ({ compProps, componentName, }) => { | ||
const useLazyComponent = ({ compProps, componentName, noSuspense, }) => { | ||
const lazy = (0, react_1.useMemo)(() => { | ||
if ('lazyComponent' in compProps && | ||
typeof compProps.lazyComponent !== 'undefined') { | ||
if (typeof compProps.lazyComponent === 'undefined') { | ||
throw new Error(`A value of \`undefined\` was passed to the \`lazyComponent\` prop. Check the value you are passing to the <${componentName}/> component.`); | ||
} | ||
return react_1.default.lazy(compProps.lazyComponent); | ||
} | ||
if ('component' in compProps) { | ||
// In SSR, suspense is not yet supported, we cannot use React.lazy | ||
if (typeof document === 'undefined') { | ||
if (typeof document === 'undefined' || noSuspense) { | ||
return compProps.component; | ||
@@ -49,2 +42,9 @@ } | ||
} | ||
if ('lazyComponent' in compProps && | ||
typeof compProps.lazyComponent !== 'undefined') { | ||
if (typeof compProps.lazyComponent === 'undefined') { | ||
throw new Error(`A value of \`undefined\` was passed to the \`lazyComponent\` prop. Check the value you are passing to the <${componentName}/> component.`); | ||
} | ||
return react_1.default.lazy(compProps.lazyComponent); | ||
} | ||
throw new Error("You must pass either 'component' or 'lazyComponent'"); | ||
@@ -51,0 +51,0 @@ // Very important to leave the dependencies as they are, or instead |
@@ -6,2 +6,2 @@ /** | ||
*/ | ||
export declare const VERSION = "4.0.270"; | ||
export declare const VERSION = "4.0.271"; |
@@ -10,2 +10,2 @@ "use strict"; | ||
*/ | ||
exports.VERSION = '4.0.270'; | ||
exports.VERSION = '4.0.271'; |
@@ -6,3 +6,3 @@ { | ||
"name": "remotion", | ||
"version": "4.0.270", | ||
"version": "4.0.271", | ||
"description": "Make videos programmatically", | ||
@@ -32,3 +32,3 @@ "main": "dist/cjs/index.js", | ||
"eslint": "9.19.0", | ||
"@remotion/eslint-config-internal": "4.0.270" | ||
"@remotion/eslint-config-internal": "4.0.271" | ||
}, | ||
@@ -35,0 +35,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
702572
18073