Update the torrent state only if new data is provided

This commit is contained in:
Grégoire Delattre 2020-04-15 12:48:29 +02:00
parent 33a84f682d
commit 135ddd0c93

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":