fix: uncontrolled component

This commit is contained in:
2025-08-14 15:05:39 -06:00
parent b4e802fdec
commit 25cf8ab255
2 changed files with 9 additions and 9 deletions

6
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -11,8 +11,8 @@ export interface RenameWordListProps {
} }
const EditWordList: FC<RenameWordListProps> = ({ currentWordList }) => { const EditWordList: FC<RenameWordListProps> = ({ currentWordList }) => {
const [internalStatus, setInternalStatus] = useState<string | undefined>() const [internalStatus, setInternalStatus] = useState<string>('')
const [newName, setNewName] = useState<string | undefined>(undefined) const [newName, setNewName] = useState<string>('')
const dialogRef = useRef<HTMLDialogElement>(null) const dialogRef = useRef<HTMLDialogElement>(null)
return ( return (
@@ -70,8 +70,8 @@ const EditWordList: FC<RenameWordListProps> = ({ currentWordList }) => {
return return
} }
dialogRef.current.close() dialogRef.current.close()
setInternalStatus(undefined) setInternalStatus('')
setNewName(undefined) setNewName('')
}} }}
> >
Close Close
@@ -98,8 +98,8 @@ const EditWordList: FC<RenameWordListProps> = ({ currentWordList }) => {
} }
addWordList(newName, internalStatus.split('\n')) addWordList(newName, internalStatus.split('\n'))
dialogRef.current.close() dialogRef.current.close()
setInternalStatus(undefined) setInternalStatus('')
setNewName(undefined) setNewName('')
}} }}
> >
Save Save