Disable the file tree "create file" name input while a request is in flight (#18001)

GitOrigin-RevId: ef505220e8cff1dce4c84483edacd96cc87bb1aa
This commit is contained in:
Alf Eaton
2024-04-25 08:04:33 +00:00
committed by Copybot
parent 2e634e665d
commit a697f9e7b0
6 changed files with 38 additions and 7 deletions
@@ -9,7 +9,7 @@ import ErrorMessage from '../error-message'
export default function FileTreeCreateNewDoc() {
const { name, validName } = useFileTreeCreateName()
const { setValid } = useFileTreeCreateForm()
const { error, finishCreatingDoc } = useFileTreeActionable()
const { error, finishCreatingDoc, inFlight } = useFileTreeActionable()
// form validation: name is valid
useEffect(() => {
@@ -32,7 +32,7 @@ export default function FileTreeCreateNewDoc() {
return (
<form noValidate id="create-file" onSubmit={handleSubmit}>
<FileTreeCreateNameInput focusName error={error} />
<FileTreeCreateNameInput focusName error={error} inFlight={inFlight} />
{error && <ErrorMessage error={error} />}
</form>
@@ -31,7 +31,7 @@ export default function FileTreeImportFromProject() {
const { name, setName, validName } = useFileTreeCreateName()
const { setValid } = useFileTreeCreateForm()
const { error, finishCreatingLinkedFile } = useFileTreeActionable()
const { error, finishCreatingLinkedFile, inFlight } = useFileTreeActionable()
const [selectedProject, setSelectedProject] = useState<Project>()
const [selectedProjectEntity, setSelectedProjectEntity] = useState<Entity>()
@@ -168,6 +168,7 @@ export default function FileTreeImportFromProject() {
}}
placeholder="example.tex"
error={error}
inFlight={inFlight}
/>
{error && <ErrorMessage error={error} />}
@@ -12,7 +12,7 @@ export default function FileTreeImportFromUrl() {
const { t } = useTranslation()
const { name, setName, validName } = useFileTreeCreateName()
const { setValid } = useFileTreeCreateForm()
const { finishCreatingLinkedFile, error } = useFileTreeActionable()
const { finishCreatingLinkedFile, error, inFlight } = useFileTreeActionable()
const [url, setUrl] = useState('')
@@ -70,6 +70,7 @@ export default function FileTreeImportFromUrl() {
label={t('file_name_in_this_project')}
placeholder="my_file"
error={error}
inFlight={inFlight}
/>
{error && <ErrorMessage error={error} />}