Skip to content

Sheets: a whole page pushed again with the same data draws the sheet again - #8

Merged
jamescalam merged 2 commits into
mainfrom
sheets-244
Nov 15, 2026
Merged

jamescalam merged 2 commits into
mainfrom
sheets-244

Conversation

@jamescalam

Copy link
Copy Markdown
Contributor

A whole page pushed again with the same data now makes the sheet draw itself again. Before this, the status line, the cell's address and sometimes the whole grid were left as the platform's morph had reset them.

What went wrong

A live push whose scripts haven't changed is morphed in place, and no script runs again. Wherever the morph can't tell the pushed page's source apart from what the page's script drew, it puts the source back:

What the script drew After a morph of the same data, before this change
Status line ("No error cells. Edits save for everyone…") Loading…
Cell address (Summary!B3) A1, while the bar still shows B3's formula
Grid, tabs, charts kept when the tab has the page before to compare against; emptied when it hasn't (the saved version couldn't be fetched within 1.5 s, or a patch came in between)

The ss:live listener only redrew when #sheet-data's text had changed, or when a batch arrived. A whole page with the same data was left as the morph made it.

A real build reaches this. sheet-format.md asks the agent to write saved_at. When data.json keeps it and the last push before save was a whole page, save pushes a page identical to the one already on screen. One example is a 14 Nov bench run: data.json last changed at 65.8 s, then the page was pushed at 69.7 s and the save pushed it again at 77.0 s. A tab watching that run ends showing "Loading…". A push that changes only the description has the same effect.

The change

sheet-template.html: after any whole page (ss:live names sheet-data) whose data is the same, the listener calls redraw(). That function runs render() and select(), then puts the person's place back, as retake() does. A batch is still applied once and drawn once. A whole page that empties a batch block redraws without applying the batch a second time.

Tested

  • node tests/run.js: 82/82 (Node 22). There is one new test, "after a whole page with the same data, the page draws again where the person is". It runs the page's own ss:live listener with the blocks as each kind of update leaves them: a morph or stream with the same data, one that empties a batch, new data, a batch, a diff that names neither block. On the previous template, this test and the updated regex fail (80/82).
  • npx spacesheep skills lint: well-formed, hash 4d046be9c48c.
  • In Chromium, with the platform's own morph code taken from packages/content/src/index.ts (morphNode, morphChildren, putBack, morphPage as written there), on a built two-tab sheet with a chart. Each case is a freshly loaded tab, signed in, with a cell selected:
Case Before (body text, chars) After this change
The starter, then the same page plus a paragraph 342 → 283 (status, address) 342 → 354
The same page pushed again 442 → 370 (status, address) 442 → 442
Only the description changed status, address reset nothing lost
Only the description changed, no page before 442 → 152 (grid, tabs, chart gone) nothing lost
One cell changed (control) fine fine
As above, scrolled down, half-typed in the formula bar grid gone, scroll lost typing, focus, cell and scroll kept

Worth a close look

  • whole assumes only a whole-page morph or stream names sheet-data with unchanged text. A diff names only blocks it changed, and a patch that changes sheet-data changes its text (and goes to retake()).
  • redraw() reuses kept for the place, as retake() does. The morph's own scroll events arrive a frame later, so they don't overwrite it first.

jamescalam and others added 2 commits November 15, 2026 16:22
…again

The platform's morph lays a pushed page's source over what the page's script drew wherever it can't tell them
apart: the status line and the cell's address always, and with no earlier page to compare against, the grid, the
tabs and the charts too. A page whose data block changed was read again and drawn; one whose data was the same
(a save straight after a push of the same page, which happens whenever data.json keeps its saved_at, or a new
description only) was left as the morph made it: "Loading…" in the status line, "A1" as the address, and in
the worst case an empty grid. The "ss:live" listener now draws again, where the person is, after any whole
page with the same data, and still applies a batch once.

Co-authored-by: Pointman <noreply@pointman.ai>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Pointman <noreply@pointman.ai>
Co-authored-by: Claude <noreply@anthropic.com>
@jamescalam
jamescalam merged commit 497b732 into main Nov 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant