From 4045f939751ae7b92885537a40cd72e128f590bb Mon Sep 17 00:00:00 2001 From: Egbert Bouman Date: Fri, 24 Jan 2025 15:41:41 +0100 Subject: [PATCH] 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 0f781041e4..b786e59e7e 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); setSaveAsDialogOpen(true); @@ -117,7 +118,7 @@ export function AddTorrent() { {