2/n reduce react re-renders
This commit is contained in:
parent
e6ef3ff23f
commit
89bbcd2a27
7 changed files with 66 additions and 25 deletions
|
|
@ -8,7 +8,9 @@ export const RootContent = (props: {}) => {
|
|||
let setCloseableError = useErrorStore((state) => state.setCloseableError);
|
||||
let otherError = useErrorStore((state) => state.otherError);
|
||||
let torrents = useTorrentStore((state) => state.torrents);
|
||||
let torrentsLoading = useTorrentStore((state) => state.torrentsLoading);
|
||||
let torrentsInitiallyLoading = useTorrentStore(
|
||||
(state) => state.torrentsInitiallyLoading
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="container mx-auto">
|
||||
|
|
@ -17,7 +19,7 @@ export const RootContent = (props: {}) => {
|
|||
remove={() => setCloseableError(null)}
|
||||
/>
|
||||
<ErrorComponent error={otherError} />
|
||||
<TorrentsList torrents={torrents} loading={torrentsLoading} />
|
||||
<TorrentsList torrents={torrents} loading={torrentsInitiallyLoading} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
import { useCallback, useContext, useEffect, useState } from "react";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { AddTorrentResponse, AddTorrentOptions } from "../../api-types";
|
||||
import { APIContext } from "../../context";
|
||||
import { ErrorComponent } from "../ErrorComponent";
|
||||
import { formatBytes } from "../../helper/formatBytes";
|
||||
import { ErrorWithLabel } from "../../rqbit-web";
|
||||
import { Spinner } from "../Spinner";
|
||||
import { Modal } from "./Modal";
|
||||
import { ModalBody } from "./ModalBody";
|
||||
import { ModalFooter } from "./ModalFooter";
|
||||
import { Button } from "../buttons/Button";
|
||||
import { FormCheckbox } from "../forms/FormCheckbox";
|
||||
import { Fieldset } from "../forms/Fieldset";
|
||||
import { FormInput } from "../forms/FormInput";
|
||||
import { Form } from "../forms/Form";
|
||||
|
|
@ -40,7 +38,6 @@ export const FileSelectionModal = (props: {
|
|||
const API = useContext(APIContext);
|
||||
|
||||
useEffect(() => {
|
||||
console.log(listTorrentResponse);
|
||||
setSelectedFiles(
|
||||
new Set(listTorrentResponse?.details.files.map((_, i) => i))
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue