diff options
Diffstat (limited to 'webui/src/pages/new')
-rw-r--r-- | webui/src/pages/new/NewBugPage.tsx | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/webui/src/pages/new/NewBugPage.tsx b/webui/src/pages/new/NewBugPage.tsx index 3ab2a92a..0852ef39 100644 --- a/webui/src/pages/new/NewBugPage.tsx +++ b/webui/src/pages/new/NewBugPage.tsx @@ -1,9 +1,9 @@ -import { FormEvent, useState } from 'react'; +import { Button, Paper } from '@mui/material'; +import { Theme } from '@mui/material/styles'; +import makeStyles from '@mui/styles/makeStyles'; +import { FormEvent, useRef, useState } from 'react'; import { useNavigate } from 'react-router-dom'; -import { Button, Paper } from '@material-ui/core'; -import { makeStyles, Theme } from '@material-ui/core/styles'; - import BugTitleInput from '../../components/BugTitleForm/BugTitleInput'; import CommentInput from '../../components/CommentInput/CommentInput'; @@ -48,8 +48,8 @@ function NewBugPage() { const [issueComment, setIssueComment] = useState(''); const classes = useStyles(); - let issueTitleInput: any; - let navigate = useNavigate(); + const issueTitleInput = useRef<HTMLInputElement>(null); + const navigate = useNavigate(); function submitNewIssue(e: FormEvent) { e.preventDefault(); @@ -65,7 +65,10 @@ function NewBugPage() { const id = data.data?.newBug.bug.id; navigate('/bug/' + id); }); - issueTitleInput.value = ''; + + if (issueTitleInput.current) { + issueTitleInput.current.value = ''; + } } function isFormValid() { @@ -79,9 +82,7 @@ function NewBugPage() { <Paper className={classes.main}> <form className={classes.form} onSubmit={submitNewIssue}> <BugTitleInput - inputRef={(node) => { - issueTitleInput = node; - }} + inputRef={issueTitleInput} label="Title" variant="outlined" fullWidth |