fix: cannot read properties of undefined in selectFolderModal

This commit is contained in:
Hydra 2024-04-20 23:09:05 -03:00 committed by shadowtosser
parent 93ff4b8f7a
commit 5db7b97090

View File

@ -23,7 +23,7 @@ export function SelectFolderModal({
}: SelectFolderModalProps) { }: SelectFolderModalProps) {
const { t } = useTranslation("game_details"); const { t } = useTranslation("game_details");
const [selectedPath, setSelectedPath] = useState(null); const [selectedPath, setSelectedPath] = useState("");
const [downloadStarting, setDownloadStarting] = useState(false); const [downloadStarting, setDownloadStarting] = useState(false);
useEffect(() => { useEffect(() => {
@ -37,7 +37,7 @@ export function SelectFolderModal({
const handleChooseDownloadsPath = async () => { const handleChooseDownloadsPath = async () => {
const { filePaths } = await window.electron.showOpenDialog({ const { filePaths } = await window.electron.showOpenDialog({
defaultPath: selectedPath.downloadsPath, defaultPath: selectedPath,
properties: ["openDirectory"], properties: ["openDirectory"],
}); });
@ -49,7 +49,7 @@ export function SelectFolderModal({
const handleStartClick = () => { const handleStartClick = () => {
setDownloadStarting(true); setDownloadStarting(true);
startDownload(repack.id, selectedPath.downloadsPath).finally(() => { startDownload(repack.id, selectedPath).finally(() => {
setDownloadStarting(false); setDownloadStarting(false);
}); });
}; };
@ -65,7 +65,7 @@ export function SelectFolderModal({
<div className={styles.downloadsPathField}> <div className={styles.downloadsPathField}>
<TextField <TextField
label={t("downloads_path")} label={t("downloads_path")}
value={selectedPath.downloadsPath} value={selectedPath}
readOnly readOnly
disabled disabled
/> />