The inline editor commits by record identity, not viewport position (improvise-2wu3)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze
This commit is contained in:
Edward Langley
2026-09-22 21:37:56 -07:00
parent 473ac9622e
commit 384e04acbc
4 changed files with 100 additions and 14 deletions
+7 -3
View File
@@ -541,6 +541,10 @@ function gridTable(model) {
* back is the server's, never the string typed here. */
function edit(td, row, col, seed) {
if (editing) return;
// WHICH cell, captured now: rows renumber while the editor is open, so the
// position is not an address by commit time (improvise-2wu3).
const target = client.edit_target(row, col);
if (!target) return;
// `seed` is `RenderCell::edit_text` -- the STORED value, not the drawn one:
// `td.textContent` has been through the number format.
const original = seed;
@@ -563,9 +567,9 @@ function edit(td, row, col, seed) {
closed = true;
editing = null;
if (commit) {
const frame = client.typed_cell(row, col, input.value);
// null only if the grid moved under the editor; the repaint that
// follows restores whatever the server now says is there.
const frame = client.typed_cell(target, input.value);
// null only before any basis arrived; the repaint that follows
// restores whatever the server now says is there.
if (frame) transport.send(frame);
}
td.replaceChildren(drawn);