Skip to content

Commit b5412ac

Browse files
bpmctKira-Pilot
authored andcommitted
fix: scroll to reveal template create errors (#7464)
Co-authored-by: Kira Pilot <kira@coder.com>
1 parent a91491d commit b5412ac

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from "pages/CreateTemplatePage/TemplateUpload"
1717
import { useFormik } from "formik"
1818
import { SelectedTemplate } from "pages/CreateWorkspacePage/SelectedTemplate"
19-
import { FC } from "react"
19+
import { FC, useEffect } from "react"
2020
import { useTranslation } from "react-i18next"
2121
import {
2222
nameValidator,
@@ -224,6 +224,18 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
224224
const { t } = useTranslation("createTemplatePage")
225225
const { t: commonT } = useTranslation("common")
226226

227+
useEffect(() => {
228+
if (error) {
229+
window.scrollTo(0, 0)
230+
}
231+
}, [error])
232+
233+
useEffect(() => {
234+
if (jobError) {
235+
window.scrollTo(0, document.body.scrollHeight)
236+
}
237+
}, [logs, jobError])
238+
227239
return (
228240
<HorizontalForm onSubmit={form.handleSubmit}>
229241
{/* General info */}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy