this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Test caching shazam states

+8 -3
+7 -2
src/components/lazy-shazam.jsx
··· 7 7 // The sticky header, usually at the top 8 8 const TOP = 48; 9 9 10 - export default function LazyShazam({ children }) { 10 + const shazamIDs = {}; 11 + 12 + export default function LazyShazam({ id, children }) { 11 13 const containerRef = useRef(); 14 + const hasID = !!shazamIDs[id]; 12 15 const [visible, setVisible] = useState(false); 13 - const [visibleStart, setVisibleStart] = useState(false); 16 + const [visibleStart, setVisibleStart] = useState(hasID || false); 14 17 15 18 const { ref } = useInView({ 16 19 root: null, ··· 20 23 onChange: (inView) => { 21 24 if (inView) { 22 25 setVisible(true); 26 + if (id) shazamIDs[id] = true; 23 27 } 24 28 }, 25 29 triggerOnce: true, ··· 35 39 } else { 36 40 setVisibleStart(true); 37 41 } 42 + if (id) shazamIDs[id] = true; 38 43 } 39 44 }, []); 40 45
+1 -1
src/components/status.jsx
··· 3337 3337 3338 3338 return uniqueQuotes.map((q) => { 3339 3339 return ( 3340 - <LazyShazam> 3340 + <LazyShazam id={q.instance + q.id}> 3341 3341 <Link 3342 3342 key={q.instance + q.id} 3343 3343 to={`${q.instance ? `/${q.instance}` : ''}/s/${q.id}`}