🔄 Fixed a redux store issue with download counts

This commit is contained in:
2021-09-06 01:53:27 -07:00
parent c8061e0d5c
commit a173b4f971
7 changed files with 84 additions and 35 deletions

View File

@@ -1,8 +1,5 @@
import React, { useEffect, ReactElement } from "react";
import {
getDownloadProgress,
getBundlesForComic,
} from "../actions/airdcpp.actions";
import { getDownloadProgress } from "../actions/airdcpp.actions";
import { useDispatch, useSelector } from "react-redux";
import { RootState } from "threetwo-ui-typings";
import { isNil, map } from "lodash";
@@ -10,6 +7,7 @@ import prettyBytes from "pretty-bytes";
interface IDownloadsPanelProps {
data: any;
comicObjectId: string;
}
export const DownloadsPanel = (
@@ -18,16 +16,11 @@ export const DownloadsPanel = (
const downloadProgressTick = useSelector(
(state: RootState) => state.airdcpp.downloadProgressData,
);
const bundles = useSelector((state: RootState) => state.airdcpp.bundles);
const dispatch = useDispatch();
// useEffect(() => {
// dispatch(getDownloadProgress(props.data._id));
// }, [dispatch]);
useEffect(() => {
dispatch(getBundlesForComic(props.data._id));
}, [dispatch]);
const ProgressTick = (props) => (
<div className="column is-one-quarter">
{JSON.stringify(props.downloadProgressTick)}
@@ -71,7 +64,7 @@ export const DownloadsPanel = (
);
};
return !isNil(bundles) ? <Bundles data={bundles} /> : null;
return !isNil(props.data) ? <Bundles data={props.data} /> : null;
};
export default DownloadsPanel;