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(onboarding): don't navigate the real app from the sandbox command menu (#3703)

teo86633817ad30
diff --git a/js/app/packages/app/component/command/CommandMenu.tsx b/js/app/packages/app/component/command/CommandMenu.tsx
index 481d533de3..73a26e3aaf 100644
--- a/js/app/packages/app/component/command/CommandMenu.tsx
+++ b/js/app/packages/app/component/command/CommandMenu.tsx
@@ -102,6 +102,12 @@ export function CommandMenuInner(props: {
items?: () => CommandMenuItem[];
/** Called when the user selects an item from the menu */
onSelect?: (item: CommandMenuItem) => void;
+ /**
+ * When true, selecting an item only fires `onSelect` — no navigation,
+ * command, or search is run. Used by the onboarding sandbox so selecting a
+ * sandbox entity doesn't navigate the real app to a non-existent doc.
+ */
+ disableDefaultAction?: boolean;
/** Optional class merged onto the Panel wrapper. */
class?: string;
/** Optional depth for the Panel wrapper. */
@@ -164,6 +170,12 @@ export function CommandMenuInner(props: {
if (!item) return;
props.onSelect?.(item);
+ if (props.disableDefaultAction) {
+ // Close like a normal selection, just without navigating/running.
+ CommandState.close();
+ CommandState.setQuery('');
+ return;
+ }
analytics.track('command_menu_use', { itemType: item.bucket });
if (isCommandItem(item)) {
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx
index abcf6d71fe..63a53aa402 100644
--- a/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx
@@ -165,6 +165,7 @@ function CommandKDemo(props: LessonContentProps) {
>
<CommandMenuInner
items={filteredItems}
+ disableDefaultAction
onSelect={() => {
setCompleted(true);
props.onComplete();