Skip to content

fix: keep "workspace create" form when rendering errors #7289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
scroll to top if errors are present
  • Loading branch information
bpmct committed Apr 27, 2023
commit 8027efb0e7a810c5ea79822f13477bbabdbcfe80
11 changes: 11 additions & 0 deletions site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ export const CreateWorkspacePageView: FC<
// to disappear.
setGitAuthErrors({})
}, [props.templateGitAuth])

const workspaceErrors =
props.createWorkspaceErrors[CreateWorkspaceErrors.CREATE_WORKSPACE_ERROR]

// Scroll to top of page if errors are present
useEffect(() => {
if (props.hasTemplateErrors || Boolean(workspaceErrors)) {
window.scrollTo(0, 0)
}
}, [props.hasTemplateErrors, workspaceErrors])

const { t } = useTranslation("createWorkspacePage")
const styles = useStyles()

Expand Down