Displaying placeholders when downloads are being fetched.

This commit is contained in:
Roland 2023-01-06 09:24:36 -07:00
parent df0e04bd83
commit c1bc72754a
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 4 additions and 6 deletions

View file

@ -313,8 +313,6 @@ class StoppableRow extends React.Component {
export function Downloads() {
useTitle('Downloads');
const {t} = useContext(ThemeContext);
const {onceDownloads, recurringDownloads, fetchDownloads} = useDownloads();
const tablePlaceholder = <Placeholder>
@ -345,7 +343,7 @@ export function Downloads() {
);
let onceTable = tablePlaceholder;
if (_.isEmpty(onceDownloads)) {
if (onceDownloads && _.isEmpty(onceDownloads)) {
onceTable = <Segment>No downloads are scheduled.</Segment>
} else if (onceDownloads) {
onceTable = (
@ -364,7 +362,7 @@ export function Downloads() {
}
let recurringTable = tablePlaceholder;
if (_.isEmpty(recurringDownloads)) {
if (recurringDownloads && _.isEmpty(recurringDownloads)) {
recurringTable = <Segment>No recurring downloads are scheduled.</Segment>
} else if (recurringDownloads) {
recurringTable = <Table>

View file

@ -494,8 +494,8 @@ export const useHotspot = () => {
}
export const useDownloads = () => {
const [onceDownloads, setOnceDownloads] = useState();
const [recurringDownloads, setRecurringDownloads] = useState();
const [onceDownloads, setOnceDownloads] = useState(null);
const [recurringDownloads, setRecurringDownloads] = useState(null);
const fetchDownloads = async () => {
try {