Skip to content

Commit

Permalink
🚨 [#4606] Fix warning about uncontrolled/controlled components in sto…
Browse files Browse the repository at this point in the history
…rybook

Only affected the stories, as the Formik initialValues is initialized
incorrectly there.
  • Loading branch information
sergei-maertens committed Nov 29, 2024
1 parent d69aca5 commit 4a1fbe3
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,26 @@ import {
const NAME = 'form.registrationBackends.0.options';

const render = ({apiGroups, objectsApiGroupChoices, confidentialityLevelChoices, formData}) => (
<Formik initialValues={formData} onSubmit={fn()}>
<Formik
initialValues={{
// defaults
caseTypeIdentification: '',
documentTypeDescription: '',
zaaktype: '',
informatieobjecttype: '',
organisatieRsin: '',
zaakVertrouwelijkheidaanduiding: '',
medewerkerRoltype: '',
propertyMappings: [],
productUrl: '',
// Ensure that this is explicitly set to null instead of undefined,
// because the field is required by the serializer
objectsApiGroup: null,
// saved data, overwrites defaults
...formData,
}}
onSubmit={fn()}
>
<Form data-testid="test-form">
<ZGWFormFields
index={0}
Expand Down

0 comments on commit 4a1fbe3

Please sign in to comment.