Fix History component useEffect dependency array
This commit is contained in:
1 parent
c7ebc5aff3
commit
3c947ef6a3
1 file changed
+1
-2
@@ -19,6 +19,7 @@ function History() {
|
|||||||
const [days, setDays] = useState(7);
|
const [days, setDays] = useState(7);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
const loadHistory = async () => {
|
const loadHistory = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
@@ -31,9 +32,7 @@ function History() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
loadHistory();
|
loadHistory();
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [days]);
|
}, [days]);
|
||||||
|
|
||||||
if (loading) return <div className="container">Loading history...</div>;
|
if (loading) return <div className="container">Loading history...</div>;
|
||||||
|
|||||||
Reference in new issue
Block a user