|
@@ -1,4 +1,4 @@
|
|
|
-import { useState } from 'react'
|
|
|
|
|
|
|
+import { useEffect, useState } from 'react'
|
|
|
import PropTypes from 'prop-types'
|
|
import PropTypes from 'prop-types'
|
|
|
|
|
|
|
|
import { Button, Modal } from 'react-bootstrap'
|
|
import { Button, Modal } from 'react-bootstrap'
|
|
@@ -21,6 +21,13 @@ function FileTreeModalCreateFolder() {
|
|
|
const { isCreatingFolder, inFlight, finishCreatingFolder, cancel, error } =
|
|
const { isCreatingFolder, inFlight, finishCreatingFolder, cancel, error } =
|
|
|
useFileTreeActionable()
|
|
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
|
|
if (!isCreatingFolder) return null // the modal will not be rendered; return early
|
|
|
|
|
|
|
|
function handleHide() {
|
|
function handleHide() {
|