Fix clicking URL placeholder params not focusing value input

The PairEditor ref callback used strict equality to determine when all
rows were ready, but placeholder params (like :id) regenerate fresh IDs
on every keystroke, causing rowsRef to accumulate entries. Using >=
allows the ref to be set even when there are more registered rows than
current pairs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Gregory Schier
2026-01-14 11:28:09 -08:00
parent fe706998d4
commit ea730d0184

View File

@@ -136,8 +136,8 @@ export function PairEditor({
rowsRef.current[id] = n;
const validHandles = Object.values(rowsRef.current).filter((v) => v != null);
// NOTE: Ignore the last placeholder pair
const ready = validHandles.length === pairs.length - 1;
// Use >= because more might be added if an ID of one changes (eg. editing placeholder in URL regenerates fresh pairs every keystroke)
const ready = validHandles.length >= pairs.length - 1;
if (ready) {
setRef?.(handle);
}