this repo has no description
0
fork

Configure Feed

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

Test memoize Media

+12 -1
+12 -1
src/components/media.jsx
··· 1 1 import { getBlurHashAverageColor } from 'fast-blurhash'; 2 2 import { Fragment } from 'preact'; 3 + import { memo } from 'preact/compat'; 3 4 import { 4 5 useCallback, 5 6 useLayoutEffect, ··· 676 677 return URL.parse(url, location.origin); 677 678 } 678 679 679 - export default Media; 680 + export default memo(Media, (oldProps, newProps) => { 681 + const oldMedia = oldProps.media || {}; 682 + const newMedia = newProps.media || {}; 683 + 684 + return ( 685 + oldMedia?.id === newMedia?.id && 686 + oldMedia.url === newMedia.url && 687 + oldProps.to === newProps.to && 688 + oldProps.class === newProps.class 689 + ); 690 + });