Update useLiveImage.ts
This commit is contained in:
parent
f0e2ce1ce5
commit
1545f6c09e
|
|
@ -28,6 +28,7 @@ export function useLiveImage(
|
||||||
const finishedIteration = useRef<number>(0)
|
const finishedIteration = useRef<number>(0)
|
||||||
|
|
||||||
const prevHash = useRef<string | null>(null)
|
const prevHash = useRef<string | null>(null)
|
||||||
|
const prevPrompt = useRef<string>('')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function updateImage(url: string | null) {
|
function updateImage(url: string | null) {
|
||||||
|
|
@ -88,11 +89,11 @@ export function useLiveImage(
|
||||||
.filter((id) => id !== shapeId)
|
.filter((id) => id !== shapeId)
|
||||||
.map((id) => editor.getShape(id)) as TLShape[]
|
.map((id) => editor.getShape(id)) as TLShape[]
|
||||||
|
|
||||||
const hash = getHashForObject(shapes)
|
|
||||||
if (hash === prevHash.current) return
|
|
||||||
prevHash.current = hash
|
|
||||||
|
|
||||||
const shape = editor.getShape<LiveImageShape>(shapeId)!
|
const shape = editor.getShape<LiveImageShape>(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], {
|
const svg = await editor.getSvg([shape], {
|
||||||
background: true,
|
background: true,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue