Tags: saving an edit no longer redraws the step, so typing keeps its focus and place

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MpnF7GwNGMbngU11wjym7P
This commit is contained in:
Claude
2026-10-19 00:30:03 +00:00
parent 28d191133b
commit e1eedfbb75
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -33,10 +33,11 @@ export function makeSession(api) {
if (!queued) return;
const { name, doc } = queued;
queued = null;
const was = s.error;
s.saving = true;
try { await api.trainSaveSet(name, doc); s.error = ""; } catch (err) { s.error = `Could not save the set: ${err.message}`; }
s.saving = false;
emit();
if (s.error !== was) emit(); // a saved edit changes nothing on screen; redrawing would take the cursor out of the box being typed in
}
s.flush = async () => { clearTimeout(timer); timer = null; await push(); };
/** Change the open set in place and save it soon. Does not redraw: the controls on screen already show the edit. */
@@ -104,6 +104,7 @@ test("Tags step: a text box per item under its picture; typing saves the set and
await wait(700);
const saved = f.calls.filter((c) => c[0] === "save").pop();
assert.equal(saved[2].items[0].caption, "A cat\nsits, calmly");
assert.ok(box.isConnected && document.querySelector(".cx-captioned textarea") === box, "saving does not redraw the step: the box being typed in stays");
off();
});