Found by the Codex review on #116.
What happens
In the desktop app, and under sp start with an examples directory, the bundled example canvases are read-only. POST /__sp/comments answers 403 for one (canvas/server/sp.ts, the isExample(slug) guard).
The client does not look at the answer. flush() in canvas/src/canvasComments.ts records the body in written, sends the request with void fetch(...), and moves on. So a comment typed on an example stays on screen as if it were saved, and is gone on the next load, because no comments.json was written.
Smallest fix
The hosted canvas already has a place for a comment that cannot go to disk: localFiles in localStorage, which commentFiles lays over the committed files on every load, whether or not a server is behind the page. When the POST answers 403, keep that board's file there, the same lines the served === false branch runs. A comment on an example then stays in this browser, which is what a read-only canvas can offer.
Not part of #116: that PR leaves canvas/src/ alone.
Found by the Codex review on #116.
What happens
In the desktop app, and under
sp startwith an examples directory, the bundled example canvases are read-only.POST /__sp/commentsanswers 403 for one (canvas/server/sp.ts, theisExample(slug)guard).The client does not look at the answer.
flush()incanvas/src/canvasComments.tsrecords the body inwritten, sends the request withvoid fetch(...), and moves on. So a comment typed on an example stays on screen as if it were saved, and is gone on the next load, because nocomments.jsonwas written.Smallest fix
The hosted canvas already has a place for a comment that cannot go to disk:
localFilesinlocalStorage, whichcommentFileslays over the committed files on every load, whether or not a server is behind the page. When the POST answers 403, keep that board's file there, the same lines theserved === falsebranch runs. A comment on an example then stays in this browser, which is what a read-only canvas can offer.Not part of #116: that PR leaves
canvas/src/alone.