mirror of https://github.com/harness/drone.git
fix: [AH-580]: fix issue with reinitialising forms with new values after changing package type (#2929)
* fix: [AH-580]: fix issue with reinitialising forms with new values after changing package typepull/3586/head
parent
4ee52b0cf8
commit
3404495893
|
@ -70,14 +70,6 @@ function FormContent(props: FormContentProps): JSX.Element {
|
|||
const { values } = formikProps
|
||||
const { packageType } = values
|
||||
|
||||
useEffect(() => {
|
||||
const newDefaultValues = getDefaultValuesByRepositoryType(
|
||||
packageType as UpstreamProxyPackageType,
|
||||
{} as UpstreamRegistryRequest
|
||||
)
|
||||
formikProps.setValues(newDefaultValues)
|
||||
}, [packageType, getDefaultValuesByRepositoryType])
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<Layout.Vertical spacing="small">
|
||||
|
@ -92,6 +84,12 @@ function FormContent(props: FormContentProps): JSX.Element {
|
|||
label: getString(each.label)
|
||||
}))}
|
||||
staticItems
|
||||
onChange={(val: UpstreamProxyPackageType) => {
|
||||
const newDefaultValues = getDefaultValuesByRepositoryType(val, {
|
||||
identifier: values.identifier
|
||||
} as UpstreamRegistryRequest)
|
||||
formikProps.setValues(newDefaultValues)
|
||||
}}
|
||||
isReadonly={isPackageTypeReadonly}
|
||||
/>
|
||||
</Container>
|
||||
|
|
Loading…
Reference in New Issue