Compare commits

...

2 Commits

Author SHA1 Message Date
93e427fc73 Fix downloaded size in the torrent list
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
The downloaded size should never be more than the total size.
2020-04-15 17:16:26 +02:00
135ddd0c93 Update the torrent state only if new data is provided 2020-04-15 12:48:29 +02:00
2 changed files with 8 additions and 3 deletions

View File

@ -16,8 +16,11 @@ export const Progress = ({ torrent }) => {
} }
// Pretty sizes // Pretty sizes
const downloadedSize = prettySize(torrent.status.downloaded_size);
const totalSize = prettySize(torrent.status.total_size); const totalSize = prettySize(torrent.status.total_size);
const downloadedSize =
torrent.status.downloaded_size >= torrent.status.total_size
? totalSize
: prettySize(torrent.status.downloaded_size);
const downloadRate = prettySize(torrent.status.download_rate) + "/s"; const downloadRate = prettySize(torrent.status.download_rate) + "/s";
return ( return (
<div> <div>

View File

@ -48,8 +48,10 @@ export default (state = defaultState, action) =>
case "TORRENTS_FETCH_FULFILLED": case "TORRENTS_FETCH_FULFILLED":
draft.fetching = false; draft.fetching = false;
draft.torrents = formatTorrents(action.payload.response.data); if (action.payload.response.data) {
draft.count = action.payload.response.data.length; draft.torrents = formatTorrents(action.payload.response.data);
draft.count = action.payload.response.data.length;
}
break; break;
case "TORRENTS_SEARCH_PENDING": case "TORRENTS_SEARCH_PENDING":