* Synchronously clear the persisted draft for the current session. * Call this right after clearing `text.value` on send/steer; relying on the * text watcher is unsafe because the Composer may unmount before the watcher * flushes (e.g. when the optimistic user message replaces the empty-ses
()
| 80 | * composer), causing the next mount to reload the stale draft. |
| 81 | */ |
| 82 | function clearDraft(): void { |
| 83 | saveDraft(sessionId(), ''); |
| 84 | } |
| 85 | |
| 86 | return { text, textareaRef, autosize, loadForEdit, clearDraft }; |
| 87 | } |