Skip to content

🎥 Make videos programmatically with React

Set()

Jonny Burger578767129212
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx b/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx
index 0c7c2901ff..d353dd0979 100644
--- a/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx
+++ b/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx
@@ -303,6 +303,7 @@ export const RenderModalData: React.FC<{
inJSONEditor,
propsEditType,
jsMapUsed: serializedJSON ? serializedJSON.mapUsed : false,
+ jsSetUsed: serializedJSON ? serializedJSON.setUsed : false,
});
}, [
canSaveDefaultProps,
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/input-props-serialization.ts b/packages/cli/src/editor/components/RenderModal/SchemaEditor/input-props-serialization.ts
index 1ef4e1f71f..5226c76c40 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/input-props-serialization.ts
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/input-props-serialization.ts
@@ -3,6 +3,7 @@ export type SerializedJSONWithCustomFields = {
customDateUsed: boolean;
customFileUsed: boolean;
mapUsed: boolean;
+ setUsed: boolean;
};
const DATE_TOKEN = 'remotion-date:';
@@ -20,6 +21,7 @@ export const serializeJSONWithDate = ({
let customDateUsed = false;
let customFileUsed = false;
let mapUsed = false;
+ let setUsed = false;
const serializedString = JSON.stringify(
data,
@@ -35,6 +37,11 @@ export const serializeJSONWithDate = ({
return value;
}
+ if (item instanceof Set) {
+ setUsed = true;
+ return value;
+ }
+
if (typeof item === 'string' && item.startsWith(staticBase)) {
customFileUsed = true;
return `${FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
@@ -44,7 +51,7 @@ export const serializeJSONWithDate = ({
},
indent
);
- return {serializedString, customDateUsed, customFileUsed, mapUsed};
+ return {serializedString, customDateUsed, customFileUsed, mapUsed, setUsed};
};
export const deserializeJSONWithCustomFields = (data: string) => {
diff --git a/packages/cli/src/editor/components/RenderModal/get-render-modal-warnings.ts b/packages/cli/src/editor/components/RenderModal/get-render-modal-warnings.ts
index d194c5faba..c1fe14f3b8 100644
--- a/packages/cli/src/editor/components/RenderModal/get-render-modal-warnings.ts
+++ b/packages/cli/src/editor/components/RenderModal/get-render-modal-warnings.ts
@@ -64,12 +64,21 @@ const mapUsed = (used: boolean | undefined, inJSONEditor: boolean) => {
return null;
};
+const setUsed = (used: boolean | undefined, inJSONEditor: boolean) => {
+ if (used && inJSONEditor) {
+ return 'A `Set` was used in the schema which can not be serialized to JSON.';
+ }
+
+ return null;
+};
+
export const getRenderModalWarnings = ({
cliProps,
canSaveDefaultProps,
isCustomDateUsed,
customFileUsed,
jsMapUsed,
+ jsSetUsed,
inJSONEditor,
propsEditType,
}: {
@@ -78,6 +87,7 @@ export const getRenderModalWarnings = ({
isCustomDateUsed: boolean;
customFileUsed: boolean;
jsMapUsed: boolean;
+ jsSetUsed: boolean;
inJSONEditor: boolean;
propsEditType: PropsEditType;
}) => {
@@ -87,5 +97,6 @@ export const getRenderModalWarnings = ({
customDateUsed(isCustomDateUsed, inJSONEditor),
staticFileUsed(customFileUsed, inJSONEditor),
mapUsed(jsMapUsed, inJSONEditor),
+ setUsed(jsSetUsed, inJSONEditor),
].filter(truthy);
};