Don't reload template when navigating to edit form

This commit is contained in:
Keith J. Grant 2021-06-21 11:23:15 -07:00 committed by Shane McDonald
parent f0a6567cd8
commit 487d78cc72
No known key found for this signature in database
GPG Key ID: 6F374AF6E9EB9374
2 changed files with 7 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import JobTemplateForm from '../shared/JobTemplateForm';
import ContentLoading from '../../../components/ContentLoading';
import { CardBody } from '../../../components/Card';
function JobTemplateEdit({ template }) {
function JobTemplateEdit({ template, reloadTemplate }) {
const history = useHistory();
const [formSubmitError, setFormSubmitError] = useState(null);
const [isLoading, setIsLoading] = useState(false);
@ -64,6 +64,7 @@ function JobTemplateEdit({ template }) {
submitInstanceGroups(instanceGroups, initialInstanceGroups),
submitCredentials(credentials),
]);
reloadTemplate();
history.push(detailsUrl);
} catch (error) {
setFormSubmitError(error);

View File

@ -97,7 +97,7 @@ function Template({ setBreadcrumb }) {
useEffect(() => {
loadTemplateAndRoles();
}, [loadTemplateAndRoles, location.pathname]);
}, [loadTemplateAndRoles]);
useEffect(() => {
if (template) {
@ -205,7 +205,10 @@ function Template({ setBreadcrumb }) {
/>
</Route>
<Route key="edit" path="/templates/:templateType/:id/edit">
<JobTemplateEdit template={template} />
<JobTemplateEdit
template={template}
reloadTemplate={loadTemplateAndRoles}
/>
</Route>
<Route key="access" path="/templates/:templateType/:id/access">
<ResourceAccessList