Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(settings): keep the Settings sheet open when Connect email is cancelled (#8679)
gbirmanf7177e065b62
diff --git a/.agents/rules/web/mobile.md b/.agents/rules/web/mobile.mdindex aedfc188ea..6c73ba87c3 100644--- a/.agents/rules/web/mobile.md+++ b/.agents/rules/web/mobile.md@@ -53,7 +53,10 @@ read their code, and follow that pattern rather than inventing a new one.place with a back row.- A sheet opened from another sheet stacks on it under its own scrim, whichshares the sheets' layer (as Dialog's does), so the sheet beneath dims with- the page and only the top sheet's handle stands out.+ the page and only the top sheet's handle stands out. Open it under the+ sheet's owner (in its component tree, or `openDialog` with `owner`, as+ `useAddInboxFlow` does): a dialog mounted elsewhere starts its own dismiss+ stack, so its Cancel, Escape or Back also closes the sheet beneath.- Overlays are Kobalte or corvu layers or handle Escape: Android Back sendsEscape to the top layer. Own back stacks use `useAndroidBackNavigation`.- Persistent prompts (`toast.custom` with `persistent`) go to the promptdiff --git a/apps/web/src/features/settings/Email.tsx b/apps/web/src/features/settings/Email.tsxindex 5905204fc2..c86d791d41 100644--- a/apps/web/src/features/settings/Email.tsx+++ b/apps/web/src/features/settings/Email.tsx@@ -3,7 +3,6 @@ import {type TurnOffCalendarTarget,} from '@app/features/calendar/components/TurnOffCalendarDialog';import { useCalendarUiFlag } from '@app/features/calendar/hooks/use-calendar-ui-flag';-import { openAddInboxDialog } from '@app/features/inbox/AddInboxDialog';import { useFeatureFlag } from '@app/lib/analytics/posthog';import { toast } from '@core/component/Toast/Toast';import {@@ -108,7 +107,9 @@ export function EmailCard(const [resyncingIds, setResyncingIds] = createSignal<ReadonlySet<string>>(new Set());- const [isEmailActionPending, setIsEmailActionPending] = createSignal(false);+ // Not a disabled state: disabling the opener drops focus to <body>, which+ // is where closing the provider chooser would then return it.+ let addingInbox = false;// The primary inbox is the user's own is_primary link; it sorts to the top// and is labelled. Everything else (other own inboxes + delegated/shared) follows.@@ -122,15 +123,18 @@ export function EmailCard(return { primary, others };});- const onConnectEmail = async () => {- if (isEmailActionPending()) return;- setIsEmailActionPending(true);+ const connectEmail = async () => {try {- openAddInboxDialog();+ await startAddInbox();} finally {- setIsEmailActionPending(false);+ addingInbox = false;}};+ const onConnectEmail = () => {+ if (addingInbox) return;+ addingInbox = true;+ fireAndForget(connectEmail(), 'add-inbox');+ };const handleResyncInbox = async (linkId: string) => {setResyncingIds((prev) => new Set(prev).add(linkId));@@ -171,11 +175,7 @@ export function EmailCard(}><Show when={!emailActive()}>- <ConnectAction- label="Connect"- onClick={onConnectEmail}- disabled={isEmailActionPending()}- />+ <ConnectAction label="Connect" onClick={onConnectEmail} /></Show><Show when={props.onOpenSettings}><UiButton@@ -302,7 +302,7 @@ export function EmailCard(size="md"depth={3}aria-label="Add inbox"- onClick={openAddInboxDialog}+ onClick={onConnectEmail}><PlusIcon class="size-3.5" />Add account