mirror of
https://github.com/narrrl/narl-workspace.git
synced 2026-11-13 17:57:04 +01:00
nodes: a write changes only what it sends
`PUT /api/nodes/{id}` wrote the whole node, and a field left out was taken as
empty: a rename sent without the body erased the text. The browser always sent
it, which was the other half of the trouble. To rename a document it sent the
body it had — the draft for one open here, a copy fetched a moment earlier for
any other — and without the version it had seen, so a save made in another
tab, on the phone or over the mount in between was written over, kept only as
a revision nobody was told about.
Now `name` and `body`, like the rest, change only when they are sent. A rename
sends the name alone, and for a document open in a tile the `updated_at` that
tile last saw, so a rename of a document saved elsewhere since is refused the
way `:w` is, rather than stamping a new version over it that the next autosave
would then write the draft past. Toggling a space's board sends only that.
This commit is contained in:
1 parent
10103b81be
commit
3a6ad9453e
6 files changed
+79
-26
No files matched your search
+3
-2
@@ -478,6 +478,7 @@ export const api = {
|
||||
request<{ prev: DiaryEntry | null; next: DiaryEntry | null }>(`/diary/around/${id}`),
|
||||
|
||||
/**
|
||||
* Only what is sent changes: a rename sends the name alone.
|
||||
* `base_updated_at`: refused with 409 if the node was saved since then.
|
||||
* `restore`: the text is a revision brought back, so what it replaces is
|
||||
* kept as a revision whatever the last one was.
|
||||
@@ -485,8 +486,8 @@ export const api = {
|
||||
updateNode: (
|
||||
id: number,
|
||||
input: {
|
||||
name: string
|
||||
body: string
|
||||
name?: string
|
||||
body?: string
|
||||
created_at?: number
|
||||
has_board?: boolean
|
||||
base_updated_at?: number
|
||||
|
||||
Reference in new issue
Block a user