this repo has no description
0
fork

Configure Feed

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

Fix icon doesn't refresh when changed

+5 -3
+5 -3
src/components/icon.jsx
··· 1 1 import { memo } from 'preact/compat'; 2 - import { useEffect, useState } from 'preact/hooks'; 2 + import { useEffect, useRef, useState } from 'preact/hooks'; 3 3 4 4 const SIZES = { 5 5 s: 12, ··· 127 127 } 128 128 129 129 const [iconData, setIconData] = useState(ICONDATA[icon]); 130 + const currentIcon = useRef(icon); 130 131 useEffect(() => { 131 - if (iconData) return; 132 + if (iconData && currentIcon.current === icon) return; 132 133 (async () => { 133 134 const iconB = await iconBlock(); 134 135 setIconData(iconB.default); 135 136 ICONDATA[icon] = iconB.default; 136 137 })(); 137 - }, [iconData, icon, iconBlock]); 138 + currentIcon.current = icon; 139 + }, [icon]); 138 140 139 141 return ( 140 142 <span