fix: stop the gating effect re-suspending a resource opened on a draft

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ScVgqGpuyDMWdzVNPm7Q5f
This commit is contained in:
Diego Imbert
2026-09-05 21:47:19 +02:00
co-authored by Claude Opus 5
parent a0c094054b
commit e9cc0c7108
@@ -144,8 +144,13 @@
$effect(() => {
const wss = Object.keys(states)
const edited = { ...userEdited }
const onDraft = { ...openedOnDraft }
untrack(() => {
for (const ws of wss) setGated(ws, !edited[ws])
// A workspace opened on a saved draft is never suspended — there is no
// phantom to prevent, and a write made while suspended is dropped for
// good. Without `onDraft` here this effect re-suspends it the moment its
// handle appears, undoing the decision made when it was opened.
for (const ws of wss) setGated(ws, !edited[ws] && !onDraft[ws])
})
})