[jupyterlab-rjsf] Setting formData in SchemaForm has no effect
ktaletsk opened this issue · comments
Description
Setting formData has no effect, e.g.:
const schema = {
type: ["string"],
};
const formData = "a";
const form = new SchemaForm(schema, {formData: formData});
layout.addWidget(form);
results in a empty input field. Same goes for any forms I tried.
Expected behavior
SchemaForm renders with data from formData
.
Context
- Operating System and version: WSL2 Ubuntu 20.04
- Browser and version: Edge
- JupyterLab version: 3.0.14
jupyter-starters
version: N/A- @deathbeds/jupyterlab-rjsf: 1.0.2
Possible fixes
The issue seems to be with FormModel constructor.
SchemaForm.render()
unpacks the variables from model:
However, model constructor never sets formData
and it ends up being undefined.
Then, finalProps
mixes props and formData
(among other things)
jupyterlab-starters/packages/jupyterlab-rjsf/src/schemaform/index.tsx
Lines 77 to 97 in 6ee4a81
Since props.formData
(which comes from model) is undefined, formData
ends up being undefined and not rendered.