mirror of https://github.com/coder/coder.git
fix: scroll to reveal template create errors (#7464)
Co-authored-by: Kira Pilot <kira@coder.com>
This commit is contained in:
parent
b7f4f3a771
commit
892bddfb7b
|
@ -16,7 +16,7 @@ import {
|
|||
} from "pages/CreateTemplatePage/TemplateUpload"
|
||||
import { useFormik } from "formik"
|
||||
import { SelectedTemplate } from "pages/CreateWorkspacePage/SelectedTemplate"
|
||||
import { FC } from "react"
|
||||
import { FC, useEffect } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import {
|
||||
nameValidator,
|
||||
|
@ -224,6 +224,18 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
|
|||
const { t } = useTranslation("createTemplatePage")
|
||||
const { t: commonT } = useTranslation("common")
|
||||
|
||||
useEffect(() => {
|
||||
if (error) {
|
||||
window.scrollTo(0, 0)
|
||||
}
|
||||
}, [error])
|
||||
|
||||
useEffect(() => {
|
||||
if (jobError) {
|
||||
window.scrollTo(0, document.body.scrollHeight)
|
||||
}
|
||||
}, [logs, jobError])
|
||||
|
||||
return (
|
||||
<HorizontalForm onSubmit={form.handleSubmit}>
|
||||
{/* General info */}
|
||||
|
|
Loading…
Reference in New Issue