Skip to content

Commit

Permalink
Re-validate git url on changing git-type
Browse files Browse the repository at this point in the history
  • Loading branch information
divyanshiGupta committed Sep 9, 2021
1 parent 76ba1ae commit 3712547
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const GitSection: React.FC<GitSectionProps> = ({
name: nameTouched,
application: { name: applicationNameTouched } = {},
image: { selected: imageSelectorTouched } = {},
git: { dir: gitDirTouched } = {},
git: { dir: gitDirTouched, type: gitTypeTouched } = {},
} = touched;
const { git: { url: gitUrlError } = {} } = errors;

Expand Down Expand Up @@ -313,7 +313,7 @@ const GitSection: React.FC<GitSectionProps> = ({
setFieldValue('import.loadError', loadError);
setFieldValue('import.strategies', importStrategies);
if (importStrategies.length > 0) {
values.formType !== 'edit' && setFieldValue('import.showEditImportStrategy', false);
setFieldValue('import.showEditImportStrategy', false);
setFieldValue('import.selectedStrategy', importStrategies[0]);
setFieldValue('import.recommendedStrategy', importStrategies[0]);
} else {
Expand All @@ -324,7 +324,7 @@ const GitSection: React.FC<GitSectionProps> = ({
detectedFiles: [],
});
setFieldValue('import.recommendedStrategy', null);
values.formType !== 'edit' && setFieldValue('import.showEditImportStrategy', true);
setFieldValue('import.showEditImportStrategy', true);
}
setFieldValue('import.strategyChanged', false);

Expand Down Expand Up @@ -397,7 +397,7 @@ const GitSection: React.FC<GitSectionProps> = ({
}, [debouncedHandleGitUrlChange, sampleRepo, setFieldTouched, setFieldValue, tag]);

React.useEffect(() => {
(!dirty || gitDirTouched || formReloadCount) &&
(!dirty || gitDirTouched || gitTypeTouched || formReloadCount) &&
values.git.url &&
debouncedHandleGitUrlChange(values.git.url, values.git.ref, values.git.dir);
}, [
Expand All @@ -409,6 +409,8 @@ const GitSection: React.FC<GitSectionProps> = ({
values.git.url,
values.git.ref,
values.git.dir,
values.git.type,
gitTypeTouched,
]);

const helpText = React.useMemo(() => {
Expand Down

0 comments on commit 3712547

Please sign in to comment.