feat(ui-flow): composer focus after thread/forum create (Phase 443)

Send composer-focus-channel IPC after create-thread and create-forum-post
so the message composer autofocuses in the new thread.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-23 19:50:28 -04:00
co-authored by Cursor
parent 3ca86dc059
commit 236e7ca451
2 changed files with 15 additions and 2 deletions
+10
View File
@@ -108,6 +108,16 @@ await dispatchUiMessage(
**v0.8.174:** `update-guild-settings` IPC forwards `nsfwGateEnabled` to `platform.updateGuildSettings`.
## Composer focus channel (v0.8.406)
After `create-thread` or `create-forum-post`, dispatch emits a sidecar event (not a full IPC round-trip from the UI):
```javascript
send({ type: 'composer-focus-channel', channelId: thread.id })
```
The renderer handles `composer-focus-channel` and calls `requestComposerAutofocusForChannel(channelId)` so the message box focuses once the new thread/post channel is active. Smoke: `test:composer-autofocus-after-thread-create`. See [MESSAGE_THREADS.md](../../docs/MESSAGE_THREADS.md) and [FORUM_CHANNELS.md](../../docs/FORUM_CHANNELS.md).
## Maintenance
When adding IPC in the Pear app, add the same `msg.type` branch here first (or simultaneously) so `dispatchUiMessage` remains the single routing table.
+5 -2
View File
@@ -859,17 +859,20 @@ async function dispatchUiMessage (platform, msg, hooks = {}) {
return true
}
if (t === 'create-thread') {
await platform.createThread({ messageId: msg.messageId, name: msg.name })
const thread = await platform.createThread({ messageId: msg.messageId, name: msg.name })
pushState()
send({ type: 'composer-focus-channel', channelId: thread.id })
return true
}
if (t === 'create-forum-post') {
await platform.createForumPost({
const result = await platform.createForumPost({
title: msg.title,
content: msg.content,
tags: msg.tags
})
pushState()
const threadId = result?.thread?.id
if (threadId) send({ type: 'composer-focus-channel', channelId: threadId })
return true
}
if (t === 'set-forum-channel-palette') {