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:
@@ -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.
|
||||
|
||||
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user