Merge pull request #6644 from jakemcdermott/6638-fix-initial-playbook-value

Only clear playbook when different project is selected

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-04-08 15:45:27 +00:00 committed by GitHub
commit e270a692b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,9 +139,13 @@ function JobTemplateForm({
const handleProjectUpdate = useCallback(
newProject => {
if (project?.id !== newProject?.id) {
// Clear the selected playbook value when a different project is selected or
// when the project is deselected.
playbookHelpers.setValue(0);
}
setProject(newProject);
projectHelpers.setValue(newProject);
playbookHelpers.setValue(0);
scmHelpers.setValue('');
},
[] // eslint-disable-line react-hooks/exhaustive-deps