From 5dbc546f3337975ba0a7bbab9d543d720d56dbc0 Mon Sep 17 00:00:00 2001 From: Egbert Bouman Date: Fri, 24 Jan 2025 14:28:55 +0100 Subject: [PATCH 1/3] Fix unique key error in SelectRemotePath --- src/tribler/ui/src/dialogs/SelectRemotePath.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tribler/ui/src/dialogs/SelectRemotePath.tsx b/src/tribler/ui/src/dialogs/SelectRemotePath.tsx index aded662d20..d976372112 100644 --- a/src/tribler/ui/src/dialogs/SelectRemotePath.tsx +++ b/src/tribler/ui/src/dialogs/SelectRemotePath.tsx @@ -66,10 +66,10 @@ export default function SelectRemotePath(props: SelectRemotePathProps & JSX.Intr {selectDir ? t('PleaseSelectDirectory') : t('PleaseSelectFile')} {(currentPath || initialPath).split(separator).map((dir, index, array) => { - if (dir.length == 0 && index == 0) return <>{separator} + if (dir.length == 0 && index == 0) return {separator} else if (dir.length == 0) return return ( - <> + { let path = array.slice(0, index + 1).join(separator) + separator; @@ -83,7 +83,7 @@ export default function SelectRemotePath(props: SelectRemotePathProps & JSX.Intr {dir} {dir.endsWith(separator) ? "" : separator} - + ) })} From 5889a3f4405de95bdce30935eb293917a6a02aa0 Mon Sep 17 00:00:00 2001 From: Egbert Bouman Date: Fri, 24 Jan 2025 14:30:12 +0100 Subject: [PATCH 2/3] Fix for using selected_files from previous downloads --- src/tribler/ui/src/dialogs/SaveAs.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tribler/ui/src/dialogs/SaveAs.tsx b/src/tribler/ui/src/dialogs/SaveAs.tsx index c1066bf7f2..03666a2532 100644 --- a/src/tribler/ui/src/dialogs/SaveAs.tsx +++ b/src/tribler/ui/src/dialogs/SaveAs.tsx @@ -121,7 +121,7 @@ export default function SaveAs(props: SaveAsProps & JSX.IntrinsicAttributes & Di setMoveCompleted(false); setError(undefined); setExists(false); - setFiles([]) + setFiles([]); const newSettings = await triblerService.getSettings(); if (newSettings === undefined) { setError(`${t("ToastErrorGetSettings")} ${t("ToastErrorGenNetworkErr")}`); @@ -133,13 +133,14 @@ export default function SaveAs(props: SaveAsProps & JSX.IntrinsicAttributes & Di const safeSeeding = !!newSettings?.libtorrent?.download_defaults?.safeseeding_enabled; const safeDownloading = !!newSettings?.libtorrent?.download_defaults?.anonymity_enabled; setSettings(newSettings); - setParams({ - ...params, + setParams(prev => ({ + ...prev, destination: newSettings?.libtorrent.download_defaults.saveas ?? '', completed_dir: newSettings?.libtorrent.download_defaults.completed_dir ?? '', anon_hops: safeDownloading ? newSettings.libtorrent.download_defaults.number_hops : 0, safe_seeding: safeSeeding, - }); + selected_files: [] + })); setMoveCompleted((newSettings?.libtorrent?.download_defaults.completed_dir ?? '').length > 0); // Retrieve metainfo From 9000c47222adbd59cd440de566834464f05327c8 Mon Sep 17 00:00:00 2001 From: Egbert Bouman Date: Fri, 24 Jan 2025 15:41:41 +0100 Subject: [PATCH 3/3] Only start downloading metainfo after "Add" is clicked --- src/tribler/ui/src/components/add-torrent.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/tribler/ui/src/components/add-torrent.tsx b/src/tribler/ui/src/components/add-torrent.tsx index 6b8bdf65ee..6dc2e47a57 100644 --- a/src/tribler/ui/src/components/add-torrent.tsx +++ b/src/tribler/ui/src/components/add-torrent.tsx @@ -16,7 +16,8 @@ import { useTranslation } from "react-i18next"; export function AddTorrent() { const { t } = useTranslation(); const navigate = useNavigate(); - const inputRef = useRef(null); + const fileInputRef = useRef(null); + const uriInputRef = useRef(null); const [urlDialogOpen, setUrlDialogOpen] = useState(false); const [uriInput, setUriInput] = useState(''); @@ -47,8 +48,8 @@ export function AddTorrent() { { - if (inputRef && inputRef.current) { - inputRef.current.click(); + if (fileInputRef && fileInputRef.current) { + fileInputRef.current.click(); } }}> @@ -74,10 +75,9 @@ export function AddTorrent() { {t('MagnetDialogInputLabel')}
setUriInput(event.target.value)} />
@@ -86,7 +86,8 @@ export function AddTorrent() { variant="outline" type="submit" onClick={() => { - if (uriInput) { + if (uriInputRef.current?.value) { + setUriInput(uriInputRef.current.value); setTorrent(undefined); setUrlDialogOpen(false); (async () => { @@ -126,7 +127,7 @@ export function AddTorrent() { {