From fc6652383f6026752acf828016fe40719135daa3 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Thu, 12 Nov 2026 22:17:02 +0100 Subject: [PATCH 1/2] docs(toolkit): FileTree in the browser (js/wasm), toolkit v0.374.1 Co-Authored-By: Claude Sonnet 5.5 --- content/en/rendering/toolkit.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/content/en/rendering/toolkit.md b/content/en/rendering/toolkit.md index 562d1aff..dd09a17d 100644 --- a/content/en/rendering/toolkit.md +++ b/content/en/rendering/toolkit.md @@ -347,3 +347,12 @@ the same contract as `collabui.CollabText`. A newer refresh cancels the one in flight and makes its late answer a no-op, so a slow answer never overwrites a newer one. Without `PostUI` every refresh is synchronous, which is right for a test or a small tree. + +**In the browser (js/wasm)** (v0.374.1)**.** `RefreshStatus` always returns +`ErrSyncStatusBlocks` and never calls `Repository.Status` on the UI goroutine; +`SetRepository` and a change of `Entries` without `PostUI` publish the same error +on `StatusError()`. The refusal is not only about blocking: in js/wasm the tree +reads status only off the UI goroutine, so `Status` must either be a round trip +that would otherwise deadlock the single thread, or be safe to call from another +goroutine (a snapshot guarded by a mutex, or swapped in as an immutable copy). To +get marks, set `PostUI` and use `RefreshStatusAsync`. Native builds are unchanged. From f56a1b07b7a5c2ee347ade2087720c3acb34a442 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Thu, 12 Nov 2026 22:19:18 +0100 Subject: [PATCH 2/2] docs: state the wasm Status requirement exactly The tree never calls Status on the UI goroutine in js/wasm and cannot tell a waiting Status from a snapshot reader; Status must be safe from another goroutine. Co-Authored-By: Claude Sonnet 5.5 --- content/en/rendering/toolkit.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/content/en/rendering/toolkit.md b/content/en/rendering/toolkit.md index dd09a17d..5a818f8e 100644 --- a/content/en/rendering/toolkit.md +++ b/content/en/rendering/toolkit.md @@ -348,11 +348,13 @@ flight and makes its late answer a no-op, so a slow answer never overwrites a newer one. Without `PostUI` every refresh is synchronous, which is right for a test or a small tree. -**In the browser (js/wasm)** (v0.374.1)**.** `RefreshStatus` always returns +**In the browser (js/wasm, v0.374.1).** `RefreshStatus` always returns `ErrSyncStatusBlocks` and never calls `Repository.Status` on the UI goroutine; `SetRepository` and a change of `Entries` without `PostUI` publish the same error -on `StatusError()`. The refusal is not only about blocking: in js/wasm the tree -reads status only off the UI goroutine, so `Status` must either be a round trip -that would otherwise deadlock the single thread, or be safe to call from another -goroutine (a snapshot guarded by a mutex, or swapped in as an immutable copy). To -get marks, set `PostUI` and use `RefreshStatusAsync`. Native builds are unchanged. +on `StatusError()`. In js/wasm the tree never calls `Status` on the UI goroutine, +only from a background goroutine (set `PostUI` and use `RefreshStatusAsync`). A +`Status` that waits for a worker's reply would deadlock the single thread if +called on the UI goroutine, and the tree cannot tell such a `Status` from one that +only reads a snapshot, so it refuses both. A `Status` used in the browser must +therefore be safe to call from another goroutine: a round trip, or a +mutex-guarded or immutable snapshot. Native builds are unchanged.