mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-10-23 03:27:27 +09:00
fix: persist a valid JSON fallback when removing bindings (#6492)
## What changed Resetting a JSON binding stores the expression's evaluated value. If it evaluates to `undefined`, the serialized prop loses its `value` field and fails the build schema. This change saves `null` instead for a nullish fallback. ## Reproduction Using the SDK `prop` schema locally, a JSON prop with the `value` field omitted fails validation; adding `value: null` passes. The full test suite was not run.
This commit is contained in:
1 parent
8e4c080d95
commit
c4684c141c
1 file changed
+1
-1
@@ -55,7 +55,7 @@ export const JsonControl = ({
|
||||
value={computedValue}
|
||||
onChangeValue={(value) => onChange({ type: "json", value })}
|
||||
onChangeExpression={(value) => onChange({ type: "expression", value })}
|
||||
onRemove={(value) => onChange({ type: "json", value })}
|
||||
onRemove={(value) => onChange({ type: "json", value: value ?? null })}
|
||||
renderControl={({ readOnly }) => (
|
||||
<ExpressionEditor
|
||||
color={error ? "error" : undefined}
|
||||
|
||||
Reference in new issue
Block a user