mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Defer opening the rename dialog past the context menu's close
Opening the dialog synchronously from the menu item's onSelect races Radix's menu close/focus-restore against the dialog's focus lock and can freeze the webview (observed as an app crash on rename). Deferring one tick lets the menu fully close first. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
8aa9839884
commit
e24f4a8c8a
@@ -141,7 +141,14 @@ export function ChatListItem({
|
||||
<ContextMenuTrigger asChild>{row}</ContextMenuTrigger>
|
||||
<ContextMenuContent className="w-44">
|
||||
{onRenameChat && canRename ? (
|
||||
<ContextMenuItem onSelect={() => onRenameChat(chat.id)}>
|
||||
<ContextMenuItem
|
||||
onSelect={() => {
|
||||
// Defer past the menu's close/focus-restore: opening a dialog
|
||||
// in the same tick wrestles Radix's focus management and can
|
||||
// freeze the webview (observed as an app "crash" on rename).
|
||||
window.setTimeout(() => onRenameChat(chat.id), 0);
|
||||
}}
|
||||
>
|
||||
<Pencil className="h-3.5 w-3.5" />
|
||||
Rename chat
|
||||
</ContextMenuItem>
|
||||
|
||||
Reference in New Issue
Block a user