diff --git a/ipywidgets_jsonschema/form.py b/ipywidgets_jsonschema/form.py index 68c7861..8dbf3f9 100644 --- a/ipywidgets_jsonschema/form.py +++ b/ipywidgets_jsonschema/form.py @@ -603,6 +603,9 @@ def _resetter(): if "default" in schema: _setter(schema["default"]) + # Initially call the resetter + _resetter() + return self.construct_element( getter=lambda: [h.getter() for h in elements[:element_size]], setter=_setter, diff --git a/tests/schemas/array-defaults.json b/tests/schemas/array-defaults.json new file mode 100644 index 0000000..ede23a5 --- /dev/null +++ b/tests/schemas/array-defaults.json @@ -0,0 +1,16 @@ +{ + "default": [ + "foo", + "bar" + ], + "schema": { + "default": [ + "foo", + "bar" + ], + "items": { + "type": "string" + }, + "type": "array" + } +}