diff --git a/packages/react-integration/src/SvgImage.tsx b/packages/react-integration/src/SvgImage.tsx index dee1edc..851958e 100644 --- a/packages/react-integration/src/SvgImage.tsx +++ b/packages/react-integration/src/SvgImage.tsx @@ -5,7 +5,8 @@ import { onSrcUpdate as onSrcUpdateRaw, onUnmount as onUnmountRaw } from "integr export interface SvgImageProps extends React.SVGAttributes, SvgImagePropsRaw {} export function SvgImage({ src, useElAttrs, ...attrs }: SvgImageProps) { - const [id, setId] = useState(""); + let actualId = ""; + const [id, setId] = useState(actualId); const [svgAttrs, setSvgAttrs] = useState>({}); let prevSrc = ""; @@ -14,6 +15,7 @@ export function SvgImage({ src, useElAttrs, ...attrs }: SvgImageProps) { if (res.id) { setId(res.id); + actualId = res.id; } if (res.attrs) { @@ -28,8 +30,8 @@ export function SvgImage({ src, useElAttrs, ...attrs }: SvgImageProps) { // When component will be unmounted useEffect(() => { - return () => onUnmountRaw(id); - }, [src]); + return () => onUnmountRaw(actualId); + }, []); return ( diff --git a/packages/vite-awesome-svg-loader/package.json b/packages/vite-awesome-svg-loader/package.json index a628dbe..7169cc4 100644 --- a/packages/vite-awesome-svg-loader/package.json +++ b/packages/vite-awesome-svg-loader/package.json @@ -27,7 +27,7 @@ "vite-awesome-svg-loader", "svgo" ], - "version": "1.3.4", + "version": "1.3.5", "homepage": "https://github.com/matafokka/vite-awesome-svg-loader", "repository": "https://github.com/matafokka/vite-awesome-svg-loader", "license": "LGPL-2.1-or-later",