Key image-gen LoRA rows by index so typing a repo id keeps input focus

The LoRA row div was keyed on sel.id, the editable repo-id field. Typing the
first character changed the key from the fallback index to that character, which
remounted the row and dropped focus on the input, so only one character was ever
captured and manual entry of a repo id was impossible (paste still worked). The
list is index-addressed (every mutation uses j === i) and rows are removed
explicitly via the delete button, so the index is the stable key, matching the
reference-image rows above.
This commit is contained in:
Daniel Han 2026-07-08 07:19:13 +00:00
commit 8fead6fcfa

View file

@ -2427,7 +2427,11 @@ export function ImagesPage({ active = true }: { active?: boolean }) {
)}
{loras.map((sel, i) => (
<div
key={sel.id || i}
// Stable key={i}: sel.id is the editable repo-id input, so keying on it would
// change the key on the first character typed, remounting the row and dropping
// input focus. The list is index-addressed (mutations below use j === i) and
// rows are removed explicitly via the button, so the index is the stable key.
key={i}
className="space-y-1.5 rounded-lg border border-border bg-muted/30 p-2"
>
<div className="flex items-center gap-2">