You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: When initialValues is set to a static object like initialValues={{type: {label: "test", value: "1"}}}, it correctly initialises the value but when the same data comes in from an API call and is passed to initialValues prop it fails to initialise it correctly. The useFormApi is correctly getting the initialValues but it does not pass through to the fields.
@ag13 , hi can you provide an example in codesandbox? Changing initial values should work unless some fields were already changed, then the form will not reset the values it has to be done via the form API.
Scope: FormRenderer
Description: When initialValues is set to a static object like
initialValues={{type: {label: "test", value: "1"}}}
, it correctly initialises the value but when the same data comes in from an API call and is passed toinitialValues
prop it fails to initialise it correctly. TheuseFormApi
is correctly getting the initialValues but it does not pass through to the fields.Schema:
fields: [ { component: 'radio', name: 'type', label: 'Type', actions: { options: ['getTypes'], }, }]
Renderer code
<FormRenderer componentMapper={componentMapper} FormTemplate={FormTemplate} actionMapper={actionMapper} schema={schema} onSubmit={asyncSubmit} onCancel={() => console.log('Cancelling')} onReset={() => console.log('Resetting')} initialValues={dataFromApi} //{type: {label: "test", value: "1"}} subscription={{ values: true, initialValues: true }} />
The text was updated successfully, but these errors were encountered: