Issue
When the app is wrapped in the StrictMode component, React remounts the whole app on page load in dev mode. Thus, triggering the parentOnUnmount method of all components from the @gravity-ui/dynamic-forms package. This removes the default value in dev mode, but not in the resulting built application. This behavior sometimes results in drastically different behavior in dev and build envs. Here's the sample schema where this issue should be reproducible:
{
"defaultValue": [{}],
"type": "array",
"minLength": 1,
"items": {
"type": "object",
"properties": {
"test": {
"type": "string",
"viewSpec": {
"type": "base",
"layout": "row",
"layoutTitle": "Test"
}
}
},
"viewSpec": {
"type": "base",
"layout": "row",
"layoutTitle": "Element"
}
},
"viewSpec": {
"type": "base",
"layout": "accordeon",
"layoutTitle": "Elements",
"layoutOpen": true,
"itemLabel": "Add element"
}
}
Expected behavior
There is no difference in behaviour both with StrictMode and without it.