diff --git a/components/RandomImage.js b/components/RandomImage.js index 9af6919fb..0452dd99f 100644 --- a/components/RandomImage.js +++ b/components/RandomImage.js @@ -20,7 +20,7 @@ function RandomImage(props) { api.unsplash.random ) - const needsFetch = !error && !updating && (!imgs || cacheIndex > cache.length - 2) + const needsFetch = !error && !updating && (!imgs || cacheIndex > cacheRef.current.length - 2) React.useEffect(() => { if (needsFetch) {