Skip to content

🎥 Make videos programmatically with React

undo shown for invalid StaticFiles

Patric Salvisberg8497dbbfcc87
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.tsx
index 688686691e..e988cc1fd8 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.tsx
@@ -32,6 +32,7 @@ export const ZodStaticFileEditor: React.FC<{
showSaveButton: boolean;
onRemove: null | (() => void);
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
schema,
jsonPath,
@@ -43,14 +44,13 @@ export const ZodStaticFileEditor: React.FC<{
showSaveButton,
onRemove,
saving,
+ saveDisabledByParent,
}) => {
const z = useZodIfPossible();
if (!z) {
throw new Error('expected zod');
}
- console.log(value);
-
const [localValue, setLocalValue] = useState<LocalState>(() => {
return {
value,
@@ -112,19 +112,20 @@ export const ZodStaticFileEditor: React.FC<{
onSave(() => value);
}, [onSave, value]);
+ console.log(localValue);
return (
<div style={compact ? narrowOption : optionRow}>
<SchemaLabel
onSave={save}
showSaveButton={showSaveButton}
- isDefaultValue={value === defaultValue}
+ isDefaultValue={localValue.value === defaultValue}
compact={compact}
onReset={reset}
jsonPath={jsonPath}
onRemove={onRemove}
saving={saving}
valid={localValue.zodValidation.success}
- saveDisabledByParent={false}
+ saveDisabledByParent={saveDisabledByParent}
/>
<div style={isRoot ? undefined : container}>
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodSwitch.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodSwitch.tsx
index 17f9a84431..75896c03e8 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodSwitch.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodSwitch.tsx
@@ -91,6 +91,7 @@ export const ZodSwitch: React.FC<{
showSaveButton={showSaveButton}
onRemove={onRemove}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
}