mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 14:41:24 +08:00
fix: ensure the user can select any image in NewApiPage (#11238)
NewApiPage always show the first image in filteredPaintings. As a
result, the user is unable to select other images. This issue was
introduced in commit 0502ff4.
This commit is contained in:
parent
803f4b5a64
commit
2552d97ea7
@ -471,10 +471,16 @@ const NewApiPage: FC<{ Options: string[] }> = ({ Options }) => {
|
|||||||
const newPainting = getNewPainting()
|
const newPainting = getNewPainting()
|
||||||
addPainting(mode, newPainting)
|
addPainting(mode, newPainting)
|
||||||
setPainting(newPainting)
|
setPainting(newPainting)
|
||||||
|
} else {
|
||||||
|
// 如果当前 painting 存在于 filteredPaintings 中,则优先显示当前 painting
|
||||||
|
const found = filteredPaintings.find((p) => p.id === painting.id)
|
||||||
|
if (found) {
|
||||||
|
setPainting(found)
|
||||||
} else {
|
} else {
|
||||||
setPainting(filteredPaintings[0])
|
setPainting(filteredPaintings[0])
|
||||||
}
|
}
|
||||||
}, [filteredPaintings, mode, addPainting, getNewPainting])
|
}
|
||||||
|
}, [filteredPaintings, mode, addPainting, getNewPainting, painting.id])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = spaceClickTimer.current
|
const timer = spaceClickTimer.current
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user