Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(agents): focus new-chat composer when c→a reopens it (#7129)

Wolf Mermelstein02fe883e69cf
diff --git a/apps/web/src/features/agents-view/views/AgentsView.tsx b/apps/web/src/features/agents-view/views/AgentsView.tsx
index b240ddf2fc..ea363f3ccf 100644
--- a/apps/web/src/features/agents-view/views/AgentsView.tsx
+++ b/apps/web/src/features/agents-view/views/AgentsView.tsx
@@ -124,11 +124,18 @@ function AgentsWorkspace(props: { initialRoute?: AgentsRoute }) {
onMount(() => panel.handle.setDisplayName('Agents'));
+ let composerFocus: (() => void) | undefined;
const showComposer = () => {
if (panel.handle.content().id !== 'agents') {
panel.handle.replace({ next: { type: 'component', id: 'agents' } });
return;
}
+ // Already showing the composer: nothing remounts to retrigger autofocus,
+ // so focus it imperatively instead.
+ if (!selected() && page() === 'new') {
+ composerFocus?.();
+ return;
+ }
setSelected(undefined);
setPage('new');
};
@@ -312,6 +319,9 @@ function AgentsWorkspace(props: { initialRoute?: AgentsRoute }) {
roster={rosterSource.roster()}
rosterLoading={rosterSource.loading()}
availabilityLoading={rosterSource.availabilityLoading()}
+ registerFocus={(focus) => {
+ composerFocus = focus;
+ }}
onStart={startConversation}
onOpenRoster={openRoster}
/>