diff --git a/src/hooks/useLiveImage.ts b/src/hooks/useLiveImage.ts index 68693a5..52b264b 100644 --- a/src/hooks/useLiveImage.ts +++ b/src/hooks/useLiveImage.ts @@ -28,6 +28,7 @@ export function useLiveImage( const finishedIteration = useRef(0) const prevHash = useRef(null) + const prevPrompt = useRef('') useEffect(() => { function updateImage(url: string | null) { @@ -88,11 +89,11 @@ export function useLiveImage( .filter((id) => id !== shapeId) .map((id) => editor.getShape(id)) as TLShape[] - const hash = getHashForObject(shapes) - if (hash === prevHash.current) return - prevHash.current = hash - const shape = editor.getShape(shapeId)! + const hash = getHashForObject(shapes) + if (hash === prevHash.current && shape.props.name === prevPrompt.current) return + prevHash.current = hash + prevPrompt.current = shape.props.name const svg = await editor.getSvg([shape], { background: true,