mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #12765 from overleaf/dk-fix-create-folder-name
fix: Clear new folder input after closing modal GitOrigin-RevId: cde804212ef966f211804afc6bec1b207befeedc
This commit is contained in:
parent
0895e33235
commit
e311a22686
1 changed files with 8 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
import { useState } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
import { Button, Modal } from 'react-bootstrap'
|
||||
|
@ -21,6 +21,13 @@ function FileTreeModalCreateFolder() {
|
|||
const { isCreatingFolder, inFlight, finishCreatingFolder, cancel, error } =
|
||||
useFileTreeActionable()
|
||||
|
||||
useEffect(() => {
|
||||
if (!isCreatingFolder) {
|
||||
// clear the input when the modal is closed
|
||||
setName('')
|
||||
}
|
||||
}, [isCreatingFolder])
|
||||
|
||||
if (!isCreatingFolder) return null // the modal will not be rendered; return early
|
||||
|
||||
function handleHide() {
|
||||
|
|
Loading…
Reference in a new issue