Skip to content

🎥 Make videos programmatically with React

react if schema is changing in RenderModal

Jonny Burgere117ab86bed2
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModalJSONPropsEditor.tsx b/packages/cli/src/editor/components/RenderModal/RenderModalJSONPropsEditor.tsx
index d80a94ac5f..c040e1df20 100644
--- a/packages/cli/src/editor/components/RenderModal/RenderModalJSONPropsEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/RenderModalJSONPropsEditor.tsx
@@ -110,6 +110,11 @@ export const RenderModalJSONPropsEditor: React.FC<{
}
}, [hasChanged, onSave]);
+ // If schema is changed in code
+ useEffect(() => {
+ setLocalValue(parseJSON(localValue.str, schema));
+ }, [localValue.str, schema]);
+
useEffect(() => {
const save = keybindings.registerKeybinding({
event: 'keydown',
@@ -127,7 +132,6 @@ export const RenderModalJSONPropsEditor: React.FC<{
const reset = useCallback(() => {
setLocalValue(parseJSON(serializedJSON.serializedString, schema));
- console.log('local', parseJSON(serializedJSON.serializedString, schema));
setValue(defaultProps);
}, [defaultProps, schema, serializedJSON.serializedString, setValue]);