Comment the useEffect usage

This commit is contained in:
Paul Kaplan 2021-03-18 11:38:38 -04:00
parent f40f3fa7c7
commit 96589f4066

View file

@ -10,9 +10,12 @@ import Debug from './debug.jsx';
const StudioActivity = ({items, loading, error, onInitialLoad}) => { const StudioActivity = ({items, loading, error, onInitialLoad}) => {
const {studioId} = useParams(); const {studioId} = useParams();
// Fetch the data if none has been loaded yet. This would run only once,
// since studioId doesnt change, but the component is potentially mounted
// multiple times because of tab routing, so need to check for empty items.
useEffect(() => { useEffect(() => {
if (studioId && items.length === 0) onInitialLoad(studioId); if (studioId && items.length === 0) onInitialLoad(studioId);
}, [studioId]); }, [studioId]); // items.length intentionally left out
return ( return (
<div> <div>