Fix Photos Add, Remove, and Replace against the library picker.
Remove clears the Photos array and backing image fields; Add opens the picker with disk upload and drops empty drafts on cancel. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -301,6 +301,8 @@ export function photosFromRequest(request = {}) {
|
||||
/**
|
||||
* Apply Photos → request fields. Call before validate / queue.
|
||||
* If Edit+Qwen has cards but no Photo to change, promote the first card.
|
||||
* When `photos` is an explicit array (even empty), it is source of truth —
|
||||
* do not resurrect cards from leftover imageAId / identityStillId.
|
||||
*/
|
||||
export function applyPhotosToRequest(raw = {}) {
|
||||
const next = { ...raw }
|
||||
@@ -309,8 +311,9 @@ export function applyPhotosToRequest(raw = {}) {
|
||||
if (!Array.isArray(next.photos)) next.photos = []
|
||||
return next
|
||||
}
|
||||
const photosProvided = Array.isArray(raw.photos)
|
||||
let photos = normalizePhotos(next.photos, plan)
|
||||
if (!photos.length && (next.imageAId || next.identityStillId || next.imageBId)) {
|
||||
if (!photosProvided && !photos.length && (next.imageAId || next.identityStillId || next.imageBId)) {
|
||||
photos = normalizePhotos(photosFromRequest(next), plan)
|
||||
}
|
||||
// Promote first card to Photo to change when Edit needs it.
|
||||
|
||||
Reference in New Issue
Block a user