From cf99dde4805f1792d6a56156b6a0338aa684005c Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 16 Oct 2026 21:08:04 +0200 Subject: notes: an empty note body gets a file, and the second click writes Reported from use: a note created with only a title then saved left a db.json entry with no file beside it, and reopening it said the file was missing. Cause: FileView.setText("") on a path that view has not loaded creates no file at all and reports no error. The index write (always non-empty JSON) was fine, so only the body was lost, which is why it looked like a missing file rather than a failed save. Bodies are now written by a Process running cat > with the text on stdin: verified against empty and non-empty payloads, consecutive writes on one Process, and a store with no db.json at all. The exit code is the real outcome, so a refused write reports it. Second report in the same flow: the editor stays editable after the first click, so typing more and then pressing Commit & push dropped the edit, the push carrying only what the first click wrote. The second click now writes the current title and body before it commits and pushes. --- desktop/modules/notes/README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'desktop/modules/notes/README.md') diff --git a/desktop/modules/notes/README.md b/desktop/modules/notes/README.md index 0f642b8..42f989f 100644 --- a/desktop/modules/notes/README.md +++ b/desktop/modules/notes/README.md @@ -14,9 +14,9 @@ per note, named by its creation time in epoch seconds. lists, links, inline code and quotes render; tables and fenced-code highlighting do not. - **Save** is two clicks: the first writes the note, the second reads - **Commit & push?** and pushes it. **Delete** asks first, then removes the - note and pushes the removal. With git off there is no second half, so Save - writes and returns in one. + **Commit & push?**, writes whatever you have typed since, and pushes it. + **Delete** asks first, then removes the note and pushes the removal. With git + off there is no second half, so Save writes and returns in one. - Leaving the editor with **Cancel**, the back arrow, Escape or a click outside drops unsaved text. The save is the explicit act. - **Update list** runs `git pull` and stamps `git.lastpull`. @@ -38,9 +38,12 @@ git to resolve instead. A change made on two machines at once conflicts here for the same reason it conflicts for `notes.sh`: every machine appends to the one `db.json`. -A write that fails is reported rather than assumed: the writes block, so a -refused or failing `setText` is known when it returns, and a failed commit or -push shows git's own message. +A write that fails is reported rather than assumed. A body is written by a +`Process` running `cat > ` with the text on stdin, not by a `FileView`: +`setText` with an empty string, on a path that view has not loaded, creates no +file and reports no error, which once put an empty note into `db.json` with no +file beside it. `cat` takes any content at any length, including none, and its +exit code is the outcome; a failed commit or push shows git's own message. **Git order.** `notes.sh` pulls before it writes and commits after, and the page keeps that order: creating a note pulls first, then writes on what the -- cgit v1.2.3