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(web): handle floating promises in soup, commands, entities and channels (#8259)

teo13e190953288
diff --git a/apps/web/src/features/auth/EmailAuth.tsx b/apps/web/src/features/auth/EmailAuth.tsx
index 98bd4fef9a..d0fdcc8e04 100644
--- a/apps/web/src/features/auth/EmailAuth.tsx
+++ b/apps/web/src/features/auth/EmailAuth.tsx
@@ -12,6 +12,7 @@ import { consumeInboxLinkReturn } from '@core/email-link/return-layout';
import { isMobile } from '@core/mobile/isMobile';
import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
import { whenSettled } from '@core/util/whenSettled';
+import { Telemetry } from '@macro-inc/observability';
import SpinnerIcon from '@phosphor/spinner-gap.svg';
import {
invalidateAllAfterLogin,
@@ -76,7 +77,9 @@ function EmailSignupCallback(props: Pick<EmailAuthParams, 'successPath'>) {
query,
async () => {
const onSuccess = () => {
- onSuccessfulAuth();
+ onSuccessfulAuth().catch((error) =>
+ Telemetry.error(error, { surface: 'email-auth' })
+ );
navigateToSuccess();
};
diff --git a/apps/web/src/features/auth/GithubReauthenticationPrompt.test.tsx b/apps/web/src/features/auth/GithubReauthenticationPrompt.test.tsx
index 7a35e84982..ae4ae91acf 100644
--- a/apps/web/src/features/auth/GithubReauthenticationPrompt.test.tsx
+++ b/apps/web/src/features/auth/GithubReauthenticationPrompt.test.tsx
@@ -206,13 +206,13 @@ describe('GithubReauthenticationPrompt', () => {
const cleanup = renderPrompt();
await flushPromises();
const action = getReconnectAction();
- action.onClick();
- action.onClick();
+ void action.onClick();
+ void action.onClick();
await vi.advanceTimersByTimeAsync(0);
window.dispatchEvent(
new PageTransitionEvent('pageshow', { persisted: true })
);
- action.onClick();
+ void action.onClick();
await vi.advanceTimersByTimeAsync(0);
expect(mocks.checkGithubLinkStatus).toHaveBeenCalledOnce();
expect(mocks.authenticate).toHaveBeenCalledOnce();
@@ -269,7 +269,7 @@ describe('GithubReauthenticationPrompt', () => {
);
const cleanup = renderPrompt();
await flushPromises();
- getReconnectAction().onClick();
+ await getReconnectAction().onClick();
await vi.advanceTimersByTimeAsync(0);
expect(mocks.toastCustom).toHaveBeenCalledOnce();
expect(mocks.toastDismiss).toHaveBeenCalledWith(101);
@@ -296,7 +296,7 @@ describe('GithubReauthenticationPrompt', () => {
await vi.advanceTimersByTimeAsync(0);
expect(mocks.toastCustom).toHaveBeenCalledTimes(needsReauth ? 2 : 1);
if (needsReauth) {
- getReconnectAction().onClick();
+ await getReconnectAction().onClick();
await vi.advanceTimersByTimeAsync(0);
expect(mocks.reauthenticateGithub).toHaveBeenCalledTimes(2);
}
@@ -318,7 +318,7 @@ describe('GithubReauthenticationPrompt', () => {
);
const cleanup = renderPrompt();
await flushPromises();
- getReconnectAction().onClick();
+ await getReconnectAction().onClick();
await vi.advanceTimersByTimeAsync(0);
mocks.checkGithubLinkStatus.mockRejectedValueOnce(
new Error('Network unavailable')
diff --git a/apps/web/src/features/channel/Call/CallContext.tsx b/apps/web/src/features/channel/Call/CallContext.tsx
index 19bebc3806..4421e22a3f 100644
--- a/apps/web/src/features/channel/Call/CallContext.tsx
+++ b/apps/web/src/features/channel/Call/CallContext.tsx
@@ -1069,7 +1069,7 @@ function createCallState() {
// Re-enumerate when devices change (e.g. headphones plugged in)
const handleDeviceChange = () => {
- enumerateDevices();
+ void enumerateDevices();
};
navigator.mediaDevices?.addEventListener('devicechange', handleDeviceChange);
diff --git a/apps/web/src/features/channel/Call/LivekitJsCallController.ts b/apps/web/src/features/channel/Call/LivekitJsCallController.ts
index bfe4772533..5c72f7a765 100644
--- a/apps/web/src/features/channel/Call/LivekitJsCallController.ts
+++ b/apps/web/src/features/channel/Call/LivekitJsCallController.ts
@@ -1,3 +1,4 @@
+import { Telemetry } from '@macro-inc/observability';
import type { CallTokenResponse } from '@service-call/client';
import {
type AudioCaptureOptions,
@@ -287,7 +288,9 @@ export function createLivekitJsCallController(
options.cancelPendingMediaSetup();
stopReceiverStats();
- room.disconnect();
+ room
+ .disconnect()
+ .catch((error) => Telemetry.error(error, { surface: 'livekit-call' }));
}
function dispose() {
@@ -297,7 +300,9 @@ export function createLivekitJsCallController(
const room = options.room();
if (!room) return;
- room.disconnect();
+ room
+ .disconnect()
+ .catch((error) => Telemetry.error(error, { surface: 'livekit-call' }));
room.removeAllListeners();
}
diff --git a/apps/web/src/features/channel/Channel/Channel.tsx b/apps/web/src/features/channel/Channel/Channel.tsx
index 06fb69401c..bf85a27907 100644
--- a/apps/web/src/features/channel/Channel/Channel.tsx
+++ b/apps/web/src/features/channel/Channel/Channel.tsx
@@ -55,6 +55,7 @@ import {
buildMentionMarkdownString,
markdownToPlainText,
} from '@macro-inc/lexical-core';
+import { Telemetry } from '@macro-inc/observability';
import { MessageNotificationIndexContext } from '@notifications/components/MarkMessageNotifications';
import {
invalidateChannelsActivity,
@@ -509,7 +510,9 @@ export function Channel(props: ChannelProps) {
});
},
onChat: (ctx) => {
- openChatWithInput(`${buildChannelMessageMention(ctx.message)}\n\n`);
+ openChatWithInput(`${buildChannelMessageMention(ctx.message)}\n\n`).catch(
+ (error) => Telemetry.error(error, { surface: 'channel' })
+ );
},
});
diff --git a/apps/web/src/features/channel/Channel/ChannelDropZone.tsx b/apps/web/src/features/channel/Channel/ChannelDropZone.tsx
index 2e0edd5112..2f144bf884 100644
--- a/apps/web/src/features/channel/Channel/ChannelDropZone.tsx
+++ b/apps/web/src/features/channel/Channel/ChannelDropZone.tsx
@@ -1,5 +1,6 @@
import { fileFolderDrop } from '@core/directive/fileFolderDrop';
import { handleFileFolderDrop } from '@core/util/upload';
+import { Telemetry } from '@macro-inc/observability';
import type { ParentProps } from 'solid-js';
import type { ChannelDragState } from './create-channel-drag-state';
@@ -18,11 +19,11 @@ export function ChannelDropZone(props: ChannelDropZoneProps) {
class="relative h-full flex flex-col mobile:px-0 mobile:pb-0"
use:fileFolderDrop={{
onDrop: (files, folders) => {
- handleFileFolderDrop(files, folders, (entries) => {
- void props.dragState.attachFilesToChannel?.(
- entries.map((e) => e.file)
- );
- });
+ handleFileFolderDrop(files, folders, (entries) =>
+ props.dragState.attachFilesToChannel?.(entries.map((e) => e.file))
+ ).catch((error) =>
+ Telemetry.error(error, { surface: 'channel-input' })
+ );
},
}}
>
diff --git a/apps/web/src/features/channel/Channel/create-channel-find-bar.ts b/apps/web/src/features/channel/Channel/create-channel-find-bar.ts
index bb06a9db74..4b2e06ac92 100644
--- a/apps/web/src/features/channel/Channel/create-channel-find-bar.ts
+++ b/apps/web/src/features/channel/Channel/create-channel-find-bar.ts
@@ -120,7 +120,7 @@ export function createChannelFindBar(
if (idx === 0 || rs.length === 0) return;
if (!searchQuery.hasNextPage || searchQuery.isFetchingNextPage) return;
if (rs.length - idx <= FIND_BAR_PREFETCH_THRESHOLD) {
- searchQuery.fetchNextPage();
+ void searchQuery.fetchNextPage();
}
});
@@ -143,7 +143,7 @@ export function createChannelFindBar(
for (let i = idx; i < end; i++) {
const threadId = rs[i].threadId;
if (!threadId) continue;
- queryClient.prefetchQuery(
+ void queryClient.prefetchQuery(
threadRepliesQueryOptions(
{ type: 'channel', id: channelId },
threadId
@@ -176,7 +176,7 @@ export function createChannelFindBar(
if (seen.has(aroundId)) continue;
seen.add(aroundId);
if (options.isMessageLoaded(aroundId)) continue;
- queryClient.prefetchInfiniteQuery(
+ void queryClient.prefetchInfiniteQuery(
messageTimelineQueryOptions(
{ type: 'channel', id: channelId },
aroundId
diff --git a/apps/web/src/features/channel/Channel/create-channel-hotkeys.ts b/apps/web/src/features/channel/Channel/create-channel-hotkeys.ts
index caa11f85da..dfeb394925 100644
--- a/apps/web/src/features/channel/Channel/create-channel-hotkeys.ts
+++ b/apps/web/src/features/channel/Channel/create-channel-hotkeys.ts
@@ -1,5 +1,6 @@
import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
import { TOKENS } from '@core/hotkey/tokens';
+import { Telemetry } from '@macro-inc/observability';
import type { MessageListItem } from '@service-storage/messages';
import type { Accessor } from 'solid-js';
import type { MessageActions, MessageData } from '../Message';
@@ -8,6 +9,9 @@ import { isBotMessage } from '../Thread/utils/message-actions';
import type { MessageSelection } from './create-message-selection';
import type { ThreadListNavigation } from './ThreadList';
+const reportMessageActionError = (error: unknown) =>
+ Telemetry.error(error, { surface: 'channel-hotkeys' });
+
type CreateChannelHotkeysOptions = {
selection: MessageSelection;
scrollToMessage: ThreadListNavigation['scrollToMessage'];
@@ -121,10 +125,12 @@ export function createChannelHotkeys(options: CreateChannelHotkeysOptions) {
const msg = getSelectedMessage();
if (!msg) return false;
const actions = options.getMessageActions(msg);
- actions?.onReply?.({
- message: msg,
- ...getMessageReplyPreviewTexts(msg.id),
- });
+ Promise.resolve(
+ actions?.onReply?.({
+ message: msg,
+ ...getMessageReplyPreviewTexts(msg.id),
+ })
+ ).catch(reportMessageActionError);
return true;
},
});
@@ -147,7 +153,9 @@ export function createChannelHotkeys(options: CreateChannelHotkeysOptions) {
const msg = getSelectedMessage();
if (!msg) return false;
const actions = options.getMessageActions(msg);
- actions?.onEdit?.({ message: msg });
+ Promise.resolve(actions?.onEdit?.({ message: msg })).catch(
+ reportMessageActionError
+ );
return true;
},
});
@@ -183,7 +191,9 @@ export function createChannelHotkeys(options: CreateChannelHotkeysOptions) {
const msg = getSelectedMessage();
if (!msg) return false;
const actions = options.getMessageActions(msg);
- actions?.onDelete?.({ message: msg });
+ Promise.resolve(actions?.onDelete?.({ message: msg })).catch(
+ reportMessageActionError
+ );
return true;
},
});
diff --git a/apps/web/src/features/channel/Channel/tests/create-channel-message-actions.test.ts b/apps/web/src/features/channel/Channel/tests/create-channel-message-actions.test.ts
index c4247b758a..4c530604e9 100644
--- a/apps/web/src/features/channel/Channel/tests/create-channel-message-actions.test.ts
+++ b/apps/web/src/features/channel/Channel/tests/create-channel-message-actions.test.ts
@@ -86,7 +86,7 @@ describe('createChannelMessageActions', () => {
}
);
- it('uses the live message from the reaction context when toggling', () => {
+ it('uses the live message from the reaction context when toggling', async () => {
const harness = buildHarness({ userId: 'user-1' });
const staleMessage = buildMessage({ reactions: [] });
const liveMessage = buildMessage({
@@ -94,13 +94,13 @@ describe('createChannelMessageActions', () => {
});
const actions = harness.getMessageActions(staleMessage);
- actions.onReact?.({ message: liveMessage, emoji: '👍' });
+ await actions.onReact?.({ message: liveMessage, emoji: '👍' });
expect(harness.removeReaction).toHaveBeenCalledTimes(1);
expect(harness.addReaction).not.toHaveBeenCalled();
});
- it('preserves bound thread context when reacting to a thread reply', () => {
+ it('preserves bound thread context when reacting to a thread reply', async () => {
const harness = buildHarness({ userId: 'user-1' });
const boundReply = buildMessage({
id: 'reply-1',
@@ -114,7 +114,7 @@ describe('createChannelMessageActions', () => {
});
const actions = harness.getMessageActions(boundReply);
- actions.onReact?.({ message: liveReply, emoji: '👍' });
+ await actions.onReact?.({ message: liveReply, emoji: '👍' });
expect(harness.addReaction).toHaveBeenCalledTimes(1);
expect(harness.addReaction).toHaveBeenCalledWith({
@@ -127,7 +127,7 @@ describe('createChannelMessageActions', () => {
});
});
- it('exposes reply action for thread replies', () => {
+ it('exposes reply action for thread replies', async () => {
const onReply = vi.fn();
const harness = buildHarness({ userId: 'user-1', onReply });
const reply = buildMessage({
@@ -136,7 +136,7 @@ describe('createChannelMessageActions', () => {
});
const actions = harness.getMessageActions(reply);
- actions.onReply?.({ message: reply });
+ await actions.onReply?.({ message: reply });
expect(onReply).toHaveBeenCalledWith({ message: reply });
});
diff --git a/apps/web/src/features/channel/Input/DropZone.tsx b/apps/web/src/features/channel/Input/DropZone.tsx
index cc066010bc..4da1ae6974 100644
--- a/apps/web/src/features/channel/Input/DropZone.tsx
+++ b/apps/web/src/features/channel/Input/DropZone.tsx
@@ -1,5 +1,6 @@
import { fileFolderDrop } from '@core/directive/fileFolderDrop';
import { handleFileFolderDrop } from '@core/util/upload';
+import { Telemetry } from '@macro-inc/observability';
import type { ParentProps } from 'solid-js';
import { useInputCommands } from './context';
@@ -20,9 +21,11 @@ export function DropZone(props: DropZoneProps) {
onDragStart: (valid) => props.onDragStart?.(valid),
onDragEnd: () => props.onDragEnd?.(),
onDrop: (files, folders) => {
- handleFileFolderDrop(files, folders, (entries) => {
- void commands.attachFiles(entries.map((e) => e.file));
- });
+ handleFileFolderDrop(files, folders, (entries) =>
+ commands.attachFiles(entries.map((e) => e.file))
+ ).catch((error) =>
+ Telemetry.error(error, { surface: 'channel-input' })
+ );
},
}}
>
diff --git a/apps/web/src/features/channel/Input/create-input-commands.ts b/apps/web/src/features/channel/Input/create-input-commands.ts
index 3b5045f4bd..ff11255e5a 100644
--- a/apps/web/src/features/channel/Input/create-input-commands.ts
+++ b/apps/web/src/features/channel/Input/create-input-commands.ts
@@ -1,3 +1,4 @@
+import { Telemetry } from '@macro-inc/observability';
import type { Accessor } from 'solid-js';
import type {
InputAttachmentData,
@@ -23,6 +24,9 @@ type CreateInputCommandsDeps = {
export function createInputCommands(
deps: CreateInputCommandsDeps
): InputCommands {
+ const reportCallbackError = (error: unknown) =>
+ Telemetry.error(error, { surface: 'channel-input' });
+
const removeAttachment = (attachment: InputAttachmentData) => {
deps.removeTrackedAttachment(attachment.id);
const current = deps.snapshot();
@@ -53,7 +57,9 @@ export function createInputCommands(
toggleFormatRibbon: () => {
deps.setShowFormatRibbon((open) => {
const next = !open;
- deps.callbacks?.onToggleFormatRibbon?.(next);
+ Promise.resolve(deps.callbacks?.onToggleFormatRibbon?.(next)).catch(
+ reportCallbackError
+ );
return next;
});
},
@@ -61,7 +67,9 @@ export function createInputCommands(
const current = deps.snapshot();
deps.reset();
deps.clearComposer?.();
- deps.callbacks?.onClose?.(current);
+ Promise.resolve(deps.callbacks?.onClose?.(current)).catch(
+ reportCallbackError
+ );
},
removeAttachment,
};
diff --git a/apps/web/src/features/channel/Input/create-input-view.ts b/apps/web/src/features/channel/Input/create-input-view.ts
index fb9272101a..22467e6fc2 100644
--- a/apps/web/src/features/channel/Input/create-input-view.ts
+++ b/apps/web/src/features/channel/Input/create-input-view.ts
@@ -1,4 +1,5 @@
import type { ItemMention } from '@core/component/LexicalMarkdown/plugins';
+import { Telemetry } from '@macro-inc/observability';
import { makePersisted } from '@solid-primitives/storage';
import {
type Accessor,
@@ -71,7 +72,9 @@ export function createInputView(options: CreateInputViewOptions): InputView {
on(
snapshot,
(current) => {
- options.callbacks?.onChange?.(current);
+ Promise.resolve(options.callbacks?.onChange?.(current)).catch((error) =>
+ Telemetry.error(error, { surface: 'channel-input' })
+ );
},
{ defer: true }
)
diff --git a/apps/web/src/features/channel/StandaloneThread/Replies.tsx b/apps/web/src/features/channel/StandaloneThread/Replies.tsx
index 5dda480e55..f743493f37 100644
--- a/apps/web/src/features/channel/StandaloneThread/Replies.tsx
+++ b/apps/web/src/features/channel/StandaloneThread/Replies.tsx
@@ -1,3 +1,4 @@
+import { Telemetry } from '@macro-inc/observability';
import { createMemo, For, type ParentProps, Show } from 'solid-js';
import { Message, type MessageActions, type MessageData } from '../Message';
import { Thread } from '../Thread';
@@ -165,7 +166,11 @@ export function Replies(props: RepliesProps) {
onClick={(event) => {
const parent = ctx.parent();
if (!parent) return;
- replyAction()?.({ message: parent, event });
+ Promise.resolve(
+ replyAction()?.({ message: parent, event })
+ ).catch((error) =>
+ Telemetry.error(error, { surface: 'channel-thread' })
+ );
}}
aria-label="Reply"
/>
diff --git a/apps/web/src/features/channel/Thread/create-thread-hotkeys.ts b/apps/web/src/features/channel/Thread/create-thread-hotkeys.ts
index c81933e67c..5a0e1a2c1a 100644
--- a/apps/web/src/features/channel/Thread/create-thread-hotkeys.ts
+++ b/apps/web/src/features/channel/Thread/create-thread-hotkeys.ts
@@ -5,6 +5,7 @@ import {
} from '@core/hotkey/hotkeys';
import { TOKENS } from '@core/hotkey/tokens';
import { HOTKEY_PRIORITY_HIGH } from '@core/hotkey/types';
+import { Telemetry } from '@macro-inc/observability';
import type {
Message as EntityMessage,
MessageListItem,
@@ -16,6 +17,9 @@ import { getMessageReplyPreviewTexts } from '../Message/browser-selection';
import { scrollMessageIntoView } from '../scroll-utils';
import { isBotMessage } from './utils/message-actions';
+const reportMessageActionError = (error: unknown) =>
+ Telemetry.error(error, { surface: 'channel-thread-hotkeys' });
+
type CreateThreadHotkeysOptions = {
messageListScopeId: string;
replySelection: MessageSelection;
@@ -182,10 +186,12 @@ export function createThreadHotkeys(options: CreateThreadHotkeysOptions) {
if (event?.repeat) return true;
const parentMsg = options.parentMessage();
const actions = options.getMessageActions(parentMsg);
- actions?.onReply?.({
- message: parentMsg,
- ...getMessageReplyPreviewTexts(parentMsg.id),
- });
+ Promise.resolve(
+ actions?.onReply?.({
+ message: parentMsg,
+ ...getMessageReplyPreviewTexts(parentMsg.id),
+ })
+ ).catch(reportMessageActionError);
return true;
},
}).withGroup(group);
@@ -215,7 +221,9 @@ export function createThreadHotkeys(options: CreateThreadHotkeysOptions) {
const reply = getReplyById(replyId);
if (!reply) return false;
const actions = options.getMessageActions(reply);
- actions?.onEdit?.({ message: reply });
+ Promise.resolve(actions?.onEdit?.({ message: reply })).catch(
+ reportMessageActionError
+ );
return true;
},
}).withGroup(group);
@@ -262,7 +270,9 @@ export function createThreadHotkeys(options: CreateThreadHotkeysOptions) {
const reply = getReplyById(replyId);
if (!reply) return false;
const actions = options.getMessageActions(reply);
- actions?.onDelete?.({ message: reply });
+ Promise.resolve(actions?.onDelete?.({ message: reply })).catch(
+ reportMessageActionError
+ );
return true;
},
}).withGroup(group);
diff --git a/apps/web/src/features/channels-view/channels-view-context.tsx b/apps/web/src/features/channels-view/channels-view-context.tsx
index cb1e7feb4d..c8671ad2b3 100644
--- a/apps/web/src/features/channels-view/channels-view-context.tsx
+++ b/apps/web/src/features/channels-view/channels-view-context.tsx
@@ -159,7 +159,7 @@ export const [ChannelsViewProvider, useChannelsView] =
channel: ChannelPreviewSelection,
replace = false
) => {
- navigate(
+ void navigate(
{
route: channelDetailRoute,
params: { channelId: channelIdForPreviewNavigation(channel) },
@@ -174,7 +174,7 @@ export const [ChannelsViewProvider, useChannelsView] =
channel: ChannelPreviewSelection | undefined
) => {
if (!channel) {
- navigate(
+ void navigate(
{ route: channelsSplitRoute, params: {} },
{ search: { [channelsSearch.namespace]: routeSearch() } }
);
@@ -190,7 +190,7 @@ export const [ChannelsViewProvider, useChannelsView] =
if (!selectPreview(channel)) {
if (previous) navigateToChannel(previous, true);
else
- navigate(
+ void navigate(
{ route: channelsSplitRoute, params: {} },
{
replace: true,
diff --git a/apps/web/src/features/command/Launcher.tsx b/apps/web/src/features/command/Launcher.tsx
index b3adc7a17d..eaec5aeb26 100644
--- a/apps/web/src/features/command/Launcher.tsx
+++ b/apps/web/src/features/command/Launcher.tsx
@@ -53,7 +53,7 @@ import {
import { createControlledOpenSignal } from '@core/util/createControlledOpenSignal';
import { Dialog } from '@kobalte/core/dialog';
import { getMarkdownGoldenBytes } from '@macro-inc/lexical-core/markdown-golden';
-import type { Span } from '@macro-inc/observability';
+import { type Span, Telemetry } from '@macro-inc/observability';
import ChatIcon from '@phosphor/chat.svg';
import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';
import PlusIcon from '@phosphor/plus.svg';
@@ -221,7 +221,10 @@ const createBlock = async (spec: {
span?.event('doc.navigated');
};
-const createComponent = async (spec: {
+const reportCreateBlockError = (error: unknown) =>
+ Telemetry.error(error, { surface: 'launcher' });
+
+const createComponent = (spec: {
componentId: string;
shouldInsert?: boolean;
asPopover?: boolean;
@@ -321,7 +324,7 @@ export function runCreateAction(
createPsdDocument({ projectId: options.projectId, source }),
shouldInsert,
openCreated,
- });
+ }).catch(reportCreateBlockError);
return;
case 'fig':
if (!isFeatureEnabled(enableFigViewer)) return;
@@ -332,7 +335,7 @@ export function runCreateAction(
createFigDocument({ projectId: options.projectId, source }),
shouldInsert,
openCreated,
- });
+ }).catch(reportCreateBlockError);
return;
case 'ai':
if (!isFeatureEnabled(enableAiEditor)) return;
@@ -343,7 +346,7 @@ export function runCreateAction(
createAiDocument({ projectId: options.projectId, source }),
shouldInsert,
openCreated,
- });
+ }).catch(reportCreateBlockError);
return;
case 'canvas':
createBlock({
@@ -361,7 +364,7 @@ export function runCreateAction(
},
shouldInsert,
openCreated,
- });
+ }).catch(reportCreateBlockError);
return;
case 'task':
createComponent({
@@ -389,7 +392,7 @@ export function runCreateAction(
}),
shouldInsert,
openCreated,
- });
+ }).catch(reportCreateBlockError);
return;
case 'email':
// Focus the "To" field within this gesture so the iOS keyboard opens;
@@ -435,7 +438,7 @@ export function runCreateAction(
},
shouldInsert,
openCreated,
- });
+ }).catch(reportCreateBlockError);
return;
case 'project':
createComponent({
@@ -466,7 +469,7 @@ export function runCreateAction(
},
shouldInsert,
openCreated,
- });
+ }).catch(reportCreateBlockError);
return;
case 'form':
if (!isFeatureEnabled(enableForms)) return;
@@ -486,7 +489,7 @@ export function runCreateAction(
},
shouldInsert,
openCreated,
- });
+ }).catch(reportCreateBlockError);
return;
case 'code':
createBlock({
@@ -505,7 +508,7 @@ export function runCreateAction(
},
shouldInsert,
openCreated,
- });
+ }).catch(reportCreateBlockError);
return;
case 'routine':
createComponent({ componentId: 'routine-compose', asPopover: true });
diff --git a/apps/web/src/features/entity/bulk-edit/BulkMoveToProjectView.tsx b/apps/web/src/features/entity/bulk-edit/BulkMoveToProjectView.tsx
index fb37faf9ad..5394127383 100644
--- a/apps/web/src/features/entity/bulk-edit/BulkMoveToProjectView.tsx
+++ b/apps/web/src/features/entity/bulk-edit/BulkMoveToProjectView.tsx
@@ -590,7 +590,7 @@ export const BulkMoveToProjectView = (props: {
if (e.key === 'Enter') {
e.preventDefault();
e.stopPropagation();
- submitNewFolder();
+ void submitNewFolder();
} else if (e.key === 'Escape') {
e.preventDefault();
e.stopPropagation();
diff --git a/apps/web/src/features/entity/extractors-notification/notification-actions.tsx b/apps/web/src/features/entity/extractors-notification/notification-actions.tsx
index 5101fd58fd..9383af320d 100644
--- a/apps/web/src/features/entity/extractors-notification/notification-actions.tsx
+++ b/apps/web/src/features/entity/extractors-notification/notification-actions.tsx
@@ -2,6 +2,7 @@ import { useMaybeSoup } from '@app/features/next-soup/soup-context';
import { restoreSoupFocus } from '@app/features/next-soup/utils';
import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
import { toast } from '@core/component/Toast/Toast';
+import { Telemetry } from '@macro-inc/observability';
import type { NotificationStack, UnifiedNotification } from '@notifications';
import {
executeMarkNotificationsDone,
@@ -26,6 +27,9 @@ interface SingleNotificationActionsProps {
type MarkStackDoneVariables = { notificationIds: string[] };
+export const reportNotificationActionError = (error: unknown) =>
+ Telemetry.error(error, { surface: 'notifications' });
+
export function useNotificationStackActions(props: NotificationActionsProps) {
const notificationSource = useGlobalNotificationSource();
const soup = useMaybeSoup();
@@ -49,11 +53,11 @@ export function useNotificationStackActions(props: NotificationActionsProps) {
label: 'Undo',
icon: ArrowCounterClockwise,
onClick: () => {
- handle.undo({
+ void handle.undo({
onError: () => toast.failure('Failed to undo'),
});
if (props.entityId) soup?.focus.set(props.entityId);
- restoreSoupFocus(props.entityId);
+ void restoreSoupFocus(props.entityId);
},
},
],
diff --git a/apps/web/src/features/entity/extractors-notification/notification-content.tsx b/apps/web/src/features/entity/extractors-notification/notification-content.tsx
index 19d6b6459b..04debeda25 100644
--- a/apps/web/src/features/entity/extractors-notification/notification-content.tsx
+++ b/apps/web/src/features/entity/extractors-notification/notification-content.tsx
@@ -15,7 +15,10 @@ import { Button } from '@ui';
import { createEffect, createSignal, For, onCleanup, Show } from 'solid-js';
import type { Notification } from '../types/notification';
import { extractMessageContent } from '../utils/notification';
-import { useNotificationActions } from './notification-actions';
+import {
+ reportNotificationActionError,
+ useNotificationActions,
+} from './notification-actions';
interface NotificationContentProps {
notification?: Notification;
@@ -73,7 +76,7 @@ export function DocumentMentionPill(props: {
tooltip="Mark as done"
onClick={(e) => {
e.stopPropagation();
- markAsDone();
+ markAsDone().catch(reportNotificationActionError);
}}
>
<CheckIcon class="size-2.5" />
diff --git a/apps/web/src/features/entity/extractors-notification/notification-row.tsx b/apps/web/src/features/entity/extractors-notification/notification-row.tsx
index 89c83bc399..2659953eb7 100644
--- a/apps/web/src/features/entity/extractors-notification/notification-row.tsx
+++ b/apps/web/src/features/entity/extractors-notification/notification-row.tsx
@@ -11,7 +11,10 @@ import { type JSX, Match, Show, Switch } from 'solid-js';
import { Layout } from '../core/Layout';
import type { EntityData } from '../types/entity';
import { isNotificationUnread } from '../utils/notification';
-import { useNotificationActions } from './notification-actions';
+import {
+ reportNotificationActionError,
+ useNotificationActions,
+} from './notification-actions';
import {
DocumentMentionPill,
NotificationContent,
@@ -323,7 +326,7 @@ export function NotificationRow(props: NotificationRowProps) {
};
const handleMarkAsDone = () => {
- markAsDone();
+ markAsDone().catch(reportNotificationActionError);
};
const handleMarkAsRead = async () => {
@@ -351,7 +354,7 @@ export function NotificationRow(props: NotificationRowProps) {
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
- handleClick(e);
+ handleClick(e).catch(reportNotificationActionError);
}
if (e.key === 'e' && canMarkDone()) {
e.preventDefault();
diff --git a/apps/web/src/features/entity/extractors-notification/notification-stacks.tsx b/apps/web/src/features/entity/extractors-notification/notification-stacks.tsx
index e5abf16378..c6b9937cc3 100644
--- a/apps/web/src/features/entity/extractors-notification/notification-stacks.tsx
+++ b/apps/web/src/features/entity/extractors-notification/notification-stacks.tsx
@@ -21,7 +21,10 @@ import {
filterValidNotifications,
isNotificationUnread,
} from '../utils/notification';
-import { useNotificationStackActions } from './notification-actions';
+import {
+ reportNotificationActionError,
+ useNotificationStackActions,
+} from './notification-actions';
import { NotificationContent } from './notification-content';
import { copyNotificationLink } from './notification-copy-link';
import { NotificationDescription } from './notification-description';
@@ -102,7 +105,7 @@ export function NotificationStackRow(props: {
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
- handleClick(e);
+ handleClick(e).catch(reportNotificationActionError);
}
if (e.key === 'e' && canMarkDone()) {
e.preventDefault();
diff --git a/apps/web/src/features/entity/extractors/entity-email-participants.tsx b/apps/web/src/features/entity/extractors/entity-email-participants.tsx
index db620840f3..740ea1ddb3 100644
--- a/apps/web/src/features/entity/extractors/entity-email-participants.tsx
+++ b/apps/web/src/features/entity/extractors/entity-email-participants.tsx
@@ -9,6 +9,7 @@ import {
highlightTermsInText,
mergeAdjacentMacroEmTags,
} from '@core/util/searchHighlight';
+import { Telemetry } from '@macro-inc/observability';
import CopyIcon from '@phosphor/copy.svg';
import { Surface } from '@ui';
import { createSignal, For, Show } from 'solid-js';
@@ -147,10 +148,17 @@ function abbreviateParticipants(
return [abbreviated[0], abbreviated[1]];
}
+async function writeEmailToClipboard(email: string) {
+ await navigator.clipboard.writeText(email);
+ toast.success('Email copied');
+}
+
function copyEmail(email: string, e: MouseEvent) {
e.stopPropagation();
- navigator.clipboard.writeText(email);
- toast.success('Email copied');
+ writeEmailToClipboard(email).catch((error) => {
+ Telemetry.error(error, { surface: 'email-participants' });
+ toast.failure('Failed to copy email');
+ });
}
function HiddenParticipantsTooltip(props: { hidden: ResolvedParticipant[] }) {
diff --git a/apps/web/src/features/entity/queries/dss.ts b/apps/web/src/features/entity/queries/dss.ts
index 6975466c92..4dfc749bfb 100644
--- a/apps/web/src/features/entity/queries/dss.ts
+++ b/apps/web/src/features/entity/queries/dss.ts
@@ -225,10 +225,10 @@ function invalidateAfterMove(
}
// Destination folder's list queries don't contain the entities yet, so match by project id in the key
invalidateSoupQueriesReferencing([destinationProjectId]);
- queryClient.invalidateQueries({ queryKey: ['entity'] });
+ void queryClient.invalidateQueries({ queryKey: ['entity'] });
// If moving a project, invalidate all project queries since nested projects' breadcrumbs change too
if (hasProjects) {
- queryClient.invalidateQueries({
+ void queryClient.invalidateQueries({
queryKey: ['project'],
});
}
@@ -374,10 +374,10 @@ export function createBulkRemoveFromProjectDssEntityMutation() {
// The source folders' views no longer contain the entities after the
// optimistic removal, so match them by project id in the key
invalidateSoupQueriesReferencing(context?.sourceProjectIds ?? []);
- queryClient.invalidateQueries({ queryKey: ['entity'] });
+ void queryClient.invalidateQueries({ queryKey: ['entity'] });
// Removed projects' breadcrumbs (and nested projects') change too
if (entities.some((e) => e.type === 'project')) {
- queryClient.invalidateQueries({ queryKey: ['project'] });
+ void queryClient.invalidateQueries({ queryKey: ['project'] });
}
if (isFeatureEnabled(enableGraphqlSoup)) {
return refreshActiveGraphqlSoupQueries();
@@ -433,10 +433,10 @@ export function createBulkCopyDssEntityMutation() {
onMutate: async () => {
// For copy, no optimistic update — new IDs unknown until server
- queryClient.cancelQueries({
+ await queryClient.cancelQueries({
queryKey: soupKeys.items._def,
});
- queryClient.cancelQueries({
+ await queryClient.cancelQueries({
queryKey: soupKeys.astItems._def,
});
},
@@ -448,13 +448,13 @@ export function createBulkCopyDssEntityMutation() {
}
// Trigger refetch so new items appear
- queryClient.invalidateQueries({
+ void queryClient.invalidateQueries({
queryKey: soupKeys.items._def,
});
- queryClient.invalidateQueries({
+ void queryClient.invalidateQueries({
queryKey: soupKeys.astItems._def,
});
- queryClient.invalidateQueries({ queryKey: ['entity'] });
+ void queryClient.invalidateQueries({ queryKey: ['entity'] });
if (isFeatureEnabled(enableGraphqlSoup)) {
return refreshActiveGraphqlSoupQueries();
}
diff --git a/apps/web/src/features/next-soup/actions/make-delete-action.ts b/apps/web/src/features/next-soup/actions/make-delete-action.ts
index 8579f5f55f..500ac6a556 100644
--- a/apps/web/src/features/next-soup/actions/make-delete-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-delete-action.ts
@@ -212,7 +212,7 @@ export const makeDeleteAction = (options: MakeDeleteOptions) => {
soup.selection.clear();
const next = nextSurvivingRow();
if (next || hadPartialDeletion) soup.focus.set(next?.id);
- restoreSoupFocus(next?.id);
+ void restoreSoupFocus(next?.id);
};
const trashEmailEntities = () => {
@@ -226,7 +226,7 @@ export const makeDeleteAction = (options: MakeDeleteOptions) => {
reportTrashedEmails(handle, emailEntities.length);
- restoreSoupFocus(next?.id);
+ void restoreSoupFocus(next?.id);
};
if (nonEmailEntities.length > 0) {
@@ -267,7 +267,7 @@ export const makeDeleteAction = (options: MakeDeleteOptions) => {
firstRemaining?.id ??
(hadPartialDeletion ? nextSurvivingRow()?.id : undefined);
if (target || hadPartialDeletion) soup.focus.set(target);
- restoreSoupFocus(target);
+ void restoreSoupFocus(target);
},
});
} else if (emailEntities.length > 0) {
diff --git a/apps/web/src/features/next-soup/actions/make-move-to-project-action.ts b/apps/web/src/features/next-soup/actions/make-move-to-project-action.ts
index e3c93ce8c4..f18c405272 100644
--- a/apps/web/src/features/next-soup/actions/make-move-to-project-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-move-to-project-action.ts
@@ -53,7 +53,7 @@ export const makeMoveToProjectAction = () => {
? `Moved ${entities.length} items`
: 'Moved to folder'
);
- restoreSoupFocus(nextRow?.id);
+ void restoreSoupFocus(nextRow?.id);
},
onError: () => toast.failure('Failed to move to folder'),
onCancel: () => {
@@ -61,7 +61,7 @@ export const makeMoveToProjectAction = () => {
if (firstEntity) {
soup.focus.set(firstEntity.id);
}
- restoreSoupFocus(firstEntity?.id);
+ void restoreSoupFocus(firstEntity?.id);
},
});
};
diff --git a/apps/web/src/features/next-soup/actions/make-remove-from-project-action.ts b/apps/web/src/features/next-soup/actions/make-remove-from-project-action.ts
index 38ff88ab8f..17a1de1cea 100644
--- a/apps/web/src/features/next-soup/actions/make-remove-from-project-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-remove-from-project-action.ts
@@ -44,7 +44,7 @@ export const makeRemoveFromProjectAction = () => {
if (nextRow) {
soup.focus.set(nextRow.id);
}
- restoreSoupFocus(nextRow?.id);
+ void restoreSoupFocus(nextRow?.id);
};
return { canExecute, execute, executeWithSoup };
diff --git a/apps/web/src/features/next-soup/actions/make-rename-action.ts b/apps/web/src/features/next-soup/actions/make-rename-action.ts
index faf117418e..62597d5a06 100644
--- a/apps/web/src/features/next-soup/actions/make-rename-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-rename-action.ts
@@ -57,13 +57,13 @@ export const makeRenameAction = (options: MakeRenameOptions) => {
if (firstEntity) {
soup.focus.set(firstEntity.id);
}
- restoreSoupFocus(firstEntity?.id);
+ void restoreSoupFocus(firstEntity?.id);
},
onCancel: () => {
if (firstEntity) {
soup.focus.set(firstEntity.id);
}
- restoreSoupFocus(firstEntity?.id);
+ void restoreSoupFocus(firstEntity?.id);
},
});
};
diff --git a/apps/web/src/features/next-soup/actions/use-block-entity-commands.ts b/apps/web/src/features/next-soup/actions/use-block-entity-commands.ts
index 7d51efaa61..5319fde7c0 100644
--- a/apps/web/src/features/next-soup/actions/use-block-entity-commands.ts
+++ b/apps/web/src/features/next-soup/actions/use-block-entity-commands.ts
@@ -15,6 +15,7 @@ import { createHotkeyGroup, registerHotkey } from '@core/hotkey/hotkeys';
import { TOKENS } from '@core/hotkey/tokens';
import { blockHotkeyScopeSignal } from '@core/signal/blockElement';
import { type EntityData, isEmailEntity, isTaskEntity } from '@entity';
+import { Telemetry } from '@macro-inc/observability';
import { SYSTEM_PROPERTY_IDS } from '@property/constants';
import type { Property, PropertyDefinitionDomain } from '@property/types';
import { createEffect, onCleanup } from 'solid-js';
@@ -34,6 +35,9 @@ import {
makeRenameAction,
} from './index';
+const reportEntityActionError = (error: unknown) =>
+ Telemetry.error(error, { surface: 'entity-actions' });
+
/**
* Common manipulations scoped to the current block.
* This should be called and mounted
@@ -191,7 +195,7 @@ export const useBlockEntityCommands = (
const entity = getEntity();
if (!entity) return false;
if (!deleteAction.canExecute(entity)) return false;
- deleteAction.execute([entity]);
+ void deleteAction.execute([entity]);
return true;
};
@@ -204,12 +208,14 @@ export const useBlockEntityCommands = (
// triage flow, or the entity is no longer in the surviving soup list.
const selectedRow = triageRow();
if (!soup || !selectedRow) {
- markDone.execute([entity]);
+ markDone.execute([entity]).catch(reportEntityActionError);
return true;
}
// Triage flow: mark done and advance to the next item in the list.
- markDone.executeWithSoup([selectedRow.original], soup, advanceSplitTo);
+ markDone
+ .executeWithSoup([selectedRow.original], soup, advanceSplitTo)
+ .catch(reportEntityActionError);
return true;
};
@@ -300,7 +306,7 @@ export const useBlockEntityCommands = (
const entity = getEntity();
if (!entity) return false;
if (!renameAction.canExecute(entity)) return false;
- renameAction.execute([entity]);
+ void renameAction.execute([entity]);
return true;
},
condition: () => {
@@ -326,7 +332,7 @@ export const useBlockEntityCommands = (
const entity = getEntity();
if (!entity) return false;
if (!favoriteAction.canExecute(entity)) return false;
- favoriteAction.execute([entity]);
+ void favoriteAction.execute([entity]);
return true;
},
condition: () => {
@@ -387,7 +393,7 @@ export const useBlockEntityCommands = (
const entity = getEntity();
if (!entity) return false;
if (!copyAction.canExecute(entity)) return false;
- copyAction.execute([entity]);
+ copyAction.execute([entity]).catch(reportEntityActionError);
return true;
},
condition: () => {
@@ -409,7 +415,7 @@ export const useBlockEntityCommands = (
if (!entity) return false;
e?.AT_TARGET;
if (!moveToProjectAction.canExecute(entity)) return false;
- moveToProjectAction.execute([entity]);
+ void moveToProjectAction.execute([entity]);
return true;
},
condition: () => {
@@ -430,7 +436,7 @@ export const useBlockEntityCommands = (
const entity = getEntity();
if (!entity) return true;
if (!copyLinkAction.canExecute(entity)) return true;
- copyLinkAction.execute([entity]);
+ copyLinkAction.execute([entity]).catch(reportEntityActionError);
return true;
},
condition: () => {
@@ -452,7 +458,7 @@ export const useBlockEntityCommands = (
const entity = getEntity();
if (!entity) return false;
if (!copyBranchNameAction.canExecute(entity)) return false;
- copyBranchNameAction.execute([entity]);
+ void copyBranchNameAction.execute([entity]);
return true;
},
condition: () => {
@@ -475,7 +481,7 @@ export const useBlockEntityCommands = (
scopeId,
description: 'Copy ID',
keyDownHandler: () => {
- copyEntityIdAction.executeById(blockId);
+ copyEntityIdAction.executeById(blockId).catch(reportEntityActionError);
return true;
},
displayPriority: 10,
diff --git a/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts b/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts
index 27db2915fd..c17e4999ab 100644
--- a/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts
+++ b/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts
@@ -9,6 +9,7 @@ import { HotkeyTags } from '@core/hotkey/constants';
import { createHotkeyGroup, registerHotkey } from '@core/hotkey/hotkeys';
import { TOKENS } from '@core/hotkey/tokens';
import { type EntityData, isEmailEntity, isTaskEntity } from '@entity';
+import { Telemetry } from '@macro-inc/observability';
import { SYSTEM_PROPERTY_IDS } from '@property/constants';
import type { Property, PropertyDefinitionDomain } from '@property/types';
import { type Accessor, onCleanup } from 'solid-js';
@@ -38,6 +39,9 @@ import {
} from './index';
import type { MarkDoneDelegate } from './mark-done-delegate';
+const reportEntityActionError = (error: unknown) =>
+ Telemetry.error(error, { surface: 'entity-actions' });
+
type UseEntityActionHotkeysOptions = {
scopeId: string;
list: EntityActionListState;
@@ -138,7 +142,7 @@ export const useEntityActionHotkeys = (
mergeHistory: true,
referredFrom: splitHandle.referredFrom(),
notificationSource,
- });
+ }).catch(reportEntityActionError);
};
/**
@@ -182,11 +186,13 @@ export const useEntityActionHotkeys = (
if (entities.length === 0) return false;
if (!entities.every(markDone.canExecute)) return false;
- markDone.executeWithSoup(
- entities,
- list,
- options.createActionNavigationHandler?.() ?? openNextEntity
- );
+ markDone
+ .executeWithSoup(
+ entities,
+ list,
+ options.createActionNavigationHandler?.() ?? openNextEntity
+ )
+ .catch(reportEntityActionError);
return true;
},
condition: () => {
@@ -211,7 +217,9 @@ export const useEntityActionHotkeys = (
if (entities.length === 0) return false;
if (!entities.every(markNotDone.canExecute)) return false;
- markNotDone.executeWithSoup(entities, list);
+ markNotDone
+ .executeWithSoup(entities, list)
+ .catch(reportEntityActionError);
return true;
},
condition: () => {
@@ -236,7 +244,7 @@ export const useEntityActionHotkeys = (
if (entities.length === 0) return false;
if (!entities.every(markUnread.canExecute)) return false;
- markUnread.executeWithSoup(entities, list);
+ void markUnread.executeWithSoup(entities, list);
return true;
},
condition: () => {
@@ -259,7 +267,7 @@ export const useEntityActionHotkeys = (
if (entities.length === 0) return false;
if (!entities.some(markRead.canExecute)) return false;
- markRead.executeWithSoup(entities, list);
+ void markRead.executeWithSoup(entities, list);
return true;
},
condition: () => {
@@ -285,7 +293,7 @@ export const useEntityActionHotkeys = (
if (entities.length === 0) return false;
if (!entities.every(deleteAction.canExecute)) return false;
- deleteAction.executeWithSoup(entities, list);
+ void deleteAction.executeWithSoup(entities, list);
return true;
};
const canDelete = () => {
@@ -346,7 +354,7 @@ export const useEntityActionHotkeys = (
if (!entities.every(renameAction.canExecute)) return false;
- renameAction.executeWithSoup(entities, list);
+ void renameAction.executeWithSoup(entities, list);
return true;
},
condition: () => {
@@ -375,7 +383,7 @@ export const useEntityActionHotkeys = (
if (entities.length === 0) return false;
if (!entities.every(favoriteAction.canExecute)) return false;
- favoriteAction.executeWithSoup(entities, list);
+ void favoriteAction.executeWithSoup(entities, list);
return true;
},
condition: () => {
@@ -449,7 +457,7 @@ export const useEntityActionHotkeys = (
if (entities.length === 0) return false;
if (!entities.every(copyAction.canExecute)) return false;
- copyAction.executeWithSoup(entities, list);
+ copyAction.executeWithSoup(entities, list).catch(reportEntityActionError);
return true;
},
condition: () => {
@@ -475,7 +483,7 @@ export const useEntityActionHotkeys = (
if (entities.length === 0) return false;
if (!entities.every(moveToProjectAction.canExecute)) return false;
- moveToProjectAction.executeWithSoup(entities, list);
+ void moveToProjectAction.executeWithSoup(entities, list);
return true;
},
condition: () => {
@@ -499,7 +507,9 @@ export const useEntityActionHotkeys = (
const entities = getEntitiesForAction();
if (entities.length === 0) return false;
if (!copyLinkAction.canExecute(entities[0])) return false;
- copyLinkAction.executeWithSoup(entities, list);
+ copyLinkAction
+ .executeWithSoup(entities, list)
+ .catch(reportEntityActionError);
return true;
},
condition: () => {
@@ -521,7 +531,7 @@ export const useEntityActionHotkeys = (
const entities = getEntitiesForAction();
if (entities.length === 0) return false;
if (!copyBranchNameAction.canExecute(entities[0])) return false;
- copyBranchNameAction.executeWithSoup(entities, list);
+ void copyBranchNameAction.executeWithSoup(entities, list);
return true;
},
condition: () => {
@@ -544,7 +554,9 @@ export const useEntityActionHotkeys = (
const entities = getEntitiesForAction();
if (entities.length === 0) return false;
if (!copyEntityIdAction.canExecute(entities[0])) return false;
- copyEntityIdAction.executeWithSoup(entities, list);
+ copyEntityIdAction
+ .executeWithSoup(entities, list)
+ .catch(reportEntityActionError);
return true;
},
condition: () => {
@@ -569,7 +581,7 @@ export const useEntityActionHotkeys = (
const entities = getEntitiesForAction();
if (entities.length !== 1) return false;
if (!createReminderAction.canExecute(entities[0])) return false;
- createReminderAction.executeWithSoup(entities, list, {
+ void createReminderAction.executeWithSoup(entities, list, {
advances: marksDoneOnThisView(),
onNavigate: options.createActionNavigationHandler?.() ?? openNextEntity,
});
@@ -596,7 +608,7 @@ export const useEntityActionHotkeys = (
const entities = getEntitiesForAction();
if (entities.length === 0) return false;
if (!shareAction.canExecute(entities[0])) return false;
- shareAction.executeWithSoup(entities, list);
+ void shareAction.executeWithSoup(entities, list);
return true;
},
condition: () => {
diff --git a/apps/web/src/features/next-soup/search-navigation-readers.test.tsx b/apps/web/src/features/next-soup/search-navigation-readers.test.tsx
index 559a3aee74..f4cddee94e 100644
--- a/apps/web/src/features/next-soup/search-navigation-readers.test.tsx
+++ b/apps/web/src/features/next-soup/search-navigation-readers.test.tsx
@@ -90,7 +90,7 @@ it('delivers cold and repeated Markdown targets, but never to another document i
expect(test.navigateMarkdown).toHaveBeenCalledExactlyOnceWith({
node_id: 'node',
});
- test.replay();
+ await test.replay();
await test.router.settled();
expect(test.navigateMarkdown).toHaveBeenCalledTimes(2);
test.setDocument('other-document');
@@ -112,7 +112,7 @@ it('delivers complete PDF highlight requests and replays the same page', async (
pdf_search_snippet: 'one & two',
pdf_search_highlight_terms: '["one","two"]',
});
- test.replay();
+ await test.replay();
await test.router.settled();
expect(test.pdf()).toEqual(first);
expect(test.pdf()).not.toBe(first);
@@ -124,7 +124,7 @@ it('keeps agent turn zero and creates a fresh scroll request for a repeated hit'
const test = setup({ type: 'agent', messageTurn: 0, author: 'agent' });
const first = test.agent();
expect(first).toEqual({ messageTurn: 0, author: 'agent' });
- test.replay();
+ await test.replay();
await test.router.settled();
expect(test.agent()).toEqual(first);
expect(test.agent()).not.toBe(first);
diff --git a/apps/web/src/features/next-soup/soup-view/FolderDropZone.tsx b/apps/web/src/features/next-soup/soup-view/FolderDropZone.tsx
index 4aa629b1f0..7f896b161e 100644
--- a/apps/web/src/features/next-soup/soup-view/FolderDropZone.tsx
+++ b/apps/web/src/features/next-soup/soup-view/FolderDropZone.tsx
@@ -4,6 +4,7 @@ import { fileSelector } from '@core/directive/fileSelector';
import { folderSelector } from '@core/directive/folderSelector';
import { isMobile } from '@core/mobile/isMobile';
import { handleFolderSelect } from '@core/util/upload';
+import { Telemetry } from '@macro-inc/observability';
import { createMemo, Show } from 'solid-js';
false && fileSelector;
@@ -32,7 +33,9 @@ export function FolderDropZone() {
use:fileSelector={{
multiple: true,
onSelect: (files) => {
- handleFileUpload(files);
+ handleFileUpload(files).catch((error) =>
+ Telemetry.error(error, { surface: 'file-upload' })
+ );
},
}}
class="border-0 bg-transparent p-0 font-[inherit] text-inherit underline"
diff --git a/apps/web/src/features/next-soup/soup-view/search-ask-ai-button.tsx b/apps/web/src/features/next-soup/soup-view/search-ask-ai-button.tsx
index dbfd84003c..53184e43df 100644
--- a/apps/web/src/features/next-soup/soup-view/search-ask-ai-button.tsx
+++ b/apps/web/src/features/next-soup/soup-view/search-ask-ai-button.tsx
@@ -35,7 +35,7 @@ export function SearchAskAiButton() {
scopeId: panel.splitHotkeyScope,
description: 'Ask AI',
keyDownHandler: () => {
- askAi();
+ void askAi();
return true;
},
runWithInputFocused: true,
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view-file-dropzone.tsx b/apps/web/src/features/next-soup/soup-view/soup-view-file-dropzone.tsx
index 9b30669455..3845efb213 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view-file-dropzone.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view-file-dropzone.tsx
@@ -2,6 +2,7 @@ import { useHandleFileUpload } from '@app/util/handleFileUpload';
import { FileDropOverlay } from '@core/component/FileDropOverlay';
import { fileFolderDrop } from '@core/directive/fileFolderDrop';
import { handleFileFolderDrop } from '@core/util/upload';
+import { Telemetry } from '@macro-inc/observability';
import { createSignal, type FlowComponent, Show } from 'solid-js';
false && fileFolderDrop;
@@ -23,7 +24,13 @@ export const SoupViewFileDropzone: FlowComponent<{ projectId?: string }> = (
class="relative flex flex-col size-full"
use:fileFolderDrop={{
onDrop: (fileEntries, folderEntries) => {
- handleFileFolderDrop(fileEntries, folderEntries, handleFileUpload);
+ handleFileFolderDrop(
+ fileEntries,
+ folderEntries,
+ handleFileUpload
+ ).catch((error) =>
+ Telemetry.error(error, { surface: 'file-upload' })
+ );
},
onDragStart: () => {
setIsValidDrag(true);
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view.tsx b/apps/web/src/features/next-soup/soup-view/soup-view.tsx
index 1b209b2e5c..14f07831ed 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view.tsx
@@ -91,6 +91,7 @@ import {
type SearchLocation,
} from '@entity';
import type { SoupRowFamily } from '@entity/composed/list-entity/row-geometry';
+import { Telemetry } from '@macro-inc/observability';
import CaretDownIcon from '@phosphor/caret-down.svg';
import ChevronRightIcon from '@phosphor/caret-right.svg';
import CheckIcon from '@phosphor/check.svg';
@@ -171,6 +172,10 @@ const MobileTabLoadingBar = () => (
);
const SOUP_LIST_STATE_ENTRY_KEY = 'soup.listState';
+
+const reportSoupViewError = (error: unknown) =>
+ Telemetry.error(error, { surface: 'soup-view' });
+
/** The row components a soup view can render. */
type SoupRowComponent =
| typeof ListEntity
@@ -826,7 +831,7 @@ const SoupViewListContent = (props: SoupViewListProps) => {
)
return;
- source.fetchNextPage();
+ source.fetchNextPage().catch(reportSoupViewError);
}, 15);
type EntityClickArgs = {
@@ -1229,7 +1234,9 @@ const SoupViewListContent = (props: SoupViewListProps) => {
onSwipeLeft={(entityId) => {
const entity = entityById().get(entityId);
if (!entity) return;
- markDoneAction.executeWithSoup([entity.original], soup);
+ markDoneAction
+ .executeWithSoup([entity.original], soup)
+ .catch(reportSoupViewError);
}}
setCollapseEntity={soup.collapseEntity.set}
>
@@ -1361,7 +1368,9 @@ const SoupViewListContent = (props: SoupViewListProps) => {
highlighted(),
})}
onClick={() => {
- fetchNextGroupPage(group().key);
+ fetchNextGroupPage(
+ group().key
+ ).catch(reportSoupViewError);
}}
>
<CaretDownIcon class="size-2.5" />
@@ -1423,7 +1432,7 @@ const SoupViewListContent = (props: SoupViewListProps) => {
event,
location: undefined,
rowIndex: row.index,
- });
+ }).catch(reportSoupViewError);
}}
onProjectClick={(
projectEntity,
@@ -1436,7 +1445,7 @@ const SoupViewListContent = (props: SoupViewListProps) => {
event,
location: undefined,
rowIndex: row.index,
- });
+ }).catch(reportSoupViewError);
}}
onContentHitClick={(
e: PointerEvent | MouseEvent,
@@ -1448,7 +1457,7 @@ const SoupViewListContent = (props: SoupViewListProps) => {
event: e,
location,
rowIndex: row.index,
- });
+ }).catch(reportSoupViewError);
}}
entityRowConfig={{
swipeLeftColor: 'bg-success',
diff --git a/apps/web/src/features/next-soup/soup-view/use-soup-navigation-hotkeys.ts b/apps/web/src/features/next-soup/soup-view/use-soup-navigation-hotkeys.ts
index e27ea8a99b..ef48b29938 100644
--- a/apps/web/src/features/next-soup/soup-view/use-soup-navigation-hotkeys.ts
+++ b/apps/web/src/features/next-soup/soup-view/use-soup-navigation-hotkeys.ts
@@ -9,10 +9,14 @@ import { entityIdSelector } from '@core/dom-selectors';
import { createHotkeyGroup, registerHotkey } from '@core/hotkey/hotkeys';
import { TOKENS } from '@core/hotkey/tokens';
import { type EntityData, isTaskEntity } from '@entity/types/entity';
+import { Telemetry } from '@macro-inc/observability';
import { type Accessor, createMemo, onCleanup } from 'solid-js';
import type { VirtualizerHandle } from 'virtua/solid';
import type { SoupState } from '../create-soup-state';
+const reportSoupNavigationError = (error: unknown) =>
+ Telemetry.error(error, { surface: 'soup-view' });
+
type UseSoupNavigationHotkeysOptions = {
scopeId: string;
soup: SoupState;
@@ -74,12 +78,12 @@ export const useSoupNavigationHotkeys = (
);
}
- const openEntity = (entity: EntityData) => {
+ const openEntity = async (entity: EntityData) => {
const handleContent = splitHandle.content().type;
if (handleContent === 'component' || handleContent === 'project') return;
- openEntityInSplitFromUnifiedList(entity, {
+ await openEntityInSplitFromUnifiedList(entity, {
splitHandle,
mergeHistory: true,
referredFrom: navigationReferredFrom(),
@@ -151,7 +155,7 @@ export const useSoupNavigationHotkeys = (
const fetchNextPageIfNeeded = () => {
if (!hasNextPage?.() || isFetching?.() || isFetchingNextPage?.()) return;
- fetchNextPage?.();
+ fetchNextPage?.().catch(reportSoupNavigationError);
};
const navigateDown = () => {
@@ -164,7 +168,7 @@ export const useSoupNavigationHotkeys = (
}
scrollTo(next.index);
- openEntity(next.row.original);
+ openEntity(next.row.original).catch(reportSoupNavigationError);
if (next.index >= rowCount - 1 - LOAD_MORE_DISTANCE_FROM_END) {
fetchNextPageIfNeeded();
@@ -179,7 +183,7 @@ export const useSoupNavigationHotkeys = (
if (!next) return true;
scrollTo(next.index);
- openEntity(next.row.original);
+ openEntity(next.row.original).catch(reportSoupNavigationError);
return true;
};
diff --git a/apps/web/src/features/next-soup/soup-view/use-soup-view-hotkeys.ts b/apps/web/src/features/next-soup/soup-view/use-soup-view-hotkeys.ts
index 8bb4989f81..546f86ccae 100644
--- a/apps/web/src/features/next-soup/soup-view/use-soup-view-hotkeys.ts
+++ b/apps/web/src/features/next-soup/soup-view/use-soup-view-hotkeys.ts
@@ -20,7 +20,9 @@ import {
filterValidNotifications,
isSearchEntity,
isWithNotification,
+ type SearchLocation,
} from '@entity';
+import { Telemetry } from '@macro-inc/observability';
import { openSingleStackNotification } from '@notifications';
import { type Accessor, onCleanup } from 'solid-js';
import type { VirtualizerHandle } from 'virtua/solid';
@@ -31,6 +33,9 @@ import {
VIEW_TAB_LISTS,
} from './soup-view-tabs';
+const reportSoupViewError = (error: unknown) =>
+ Telemetry.error(error, { surface: 'soup-view' });
+
type UseSoupViewHotkeysOptions = {
onOpenProject?: (id: string) => void;
onOpenEntity?: (entity: EntityData, event?: KeyboardEvent) => boolean;
@@ -150,6 +155,25 @@ export const useSoupViewHotkeys = (options: UseSoupViewHotkeysOptions) => {
return didOpen;
};
+ const openEntityFromList = async (
+ entity: EntityData,
+ openOptions: { location?: SearchLocation; openInNewSplit?: boolean }
+ ) => {
+ markCalendarNotificationSeenOnOpen(entity, notificationSource);
+ await openEntityInSplitFromUnifiedList(entity, {
+ ...openOptions,
+ splitHandle,
+ referredFrom: currentView(),
+ notificationSource,
+ });
+ };
+
+ const loadMoreInGroup = async (groupKey: string, index: number) => {
+ await fetchNextGroupPage(groupKey);
+ soup.navigate.toIndex(index);
+ virtualizerHandle()?.scrollToIndex(index, { align: 'nearest' });
+ };
+
// enter - Open entity in split, toggle group, or load more
registerHotkey({
hotkey: ['enter'],
@@ -176,13 +200,9 @@ export const useSoupViewHotkeys = (options: UseSoupViewHotkeysOptions) => {
// If focused on a load more row, trigger load more and stay at same index
if (focusedRow.getIsLoadMore() && focusedRow.group) {
- const currentIndex = focusedRow.index;
- fetchNextGroupPage(focusedRow.group.key).then(() => {
- soup.navigate.toIndex(currentIndex);
- virtualizerHandle()?.scrollToIndex(currentIndex, {
- align: 'nearest',
- });
- });
+ loadMoreInGroup(focusedRow.group.key, focusedRow.index).catch(
+ reportSoupViewError
+ );
return true;
}
@@ -204,13 +224,7 @@ export const useSoupViewHotkeys = (options: UseSoupViewHotkeysOptions) => {
const location =
contentHitData?.length === 1 ? contentHitData[0]?.location : undefined;
- markCalendarNotificationSeenOnOpen(entity, notificationSource);
- openEntityInSplitFromUnifiedList(entity, {
- splitHandle,
- location,
- referredFrom: currentView(),
- notificationSource,
- });
+ openEntityFromList(entity, { location }).catch(reportSoupViewError);
return true;
},
displayPriority: 4,
@@ -323,13 +337,9 @@ export const useSoupViewHotkeys = (options: UseSoupViewHotkeysOptions) => {
const entity = soup.focus.item();
if (!entity) return false;
- markCalendarNotificationSeenOnOpen(entity, notificationSource);
- openEntityInSplitFromUnifiedList(entity, {
- splitHandle,
- openInNewSplit: true,
- referredFrom: currentView(),
- notificationSource,
- });
+ openEntityFromList(entity, { openInNewSplit: true }).catch(
+ reportSoupViewError
+ );
return true;
},
hide: true,
diff --git a/apps/web/src/features/next-soup/utils.ts b/apps/web/src/features/next-soup/utils.ts
index e62d74191e..1aed2422ef 100644
--- a/apps/web/src/features/next-soup/utils.ts
+++ b/apps/web/src/features/next-soup/utils.ts
@@ -79,6 +79,7 @@ import {
type WithNotification,
type WithSearch,
} from '@entity';
+import { Telemetry } from '@macro-inc/observability';
import {
compositeEntity,
documentCommentLocation,
@@ -823,14 +824,20 @@ export const openEntityInSplitFromUnifiedList = async (
markNotificationsSeen();
}
- if (commentParams && entity.type === 'document') {
- // An already-open document ignores new split params.
- await navigateDocumentEntityToComment(entity, blockOrchestrator);
- } else if (!target && openChannelAtLatest) {
- // Force the scroll-to-bottom even when the channel is already open in a
- // (preview) split, where reopen: 'latest' only reactivates the parked
- // split without re-pinning it to the newest message.
- await goToChannelLatest(blockOrchestrator, content.id);
+ // The split is already open; a failed in-block navigation leaves it at its
+ // default position, so report it rather than rejecting every caller.
+ try {
+ if (commentParams && entity.type === 'document') {
+ // An already-open document ignores new split params.
+ await navigateDocumentEntityToComment(entity, blockOrchestrator);
+ } else if (!target && openChannelAtLatest) {
+ // Force the scroll-to-bottom even when the channel is already open in a
+ // (preview) split, where reopen: 'latest' only reactivates the parked
+ // split without re-pinning it to the newest message.
+ await goToChannelLatest(blockOrchestrator, content.id);
+ }
+ } catch (error) {
+ Telemetry.error(error, { surface: 'open-entity-in-split' });
}
};
@@ -1075,7 +1082,7 @@ type TrashLabel = { id: string; linkId?: string };
*/
export function trashEmails(targets: TrashEmailTarget[]): TrashEmailsHandle {
const ids = targets.map((t) => t.id);
- queryClient.cancelQueries({ queryKey: queryKeys.all.email });
+ void queryClient.cancelQueries({ queryKey: queryKeys.all.email });
const previousEmail = queryClient.getQueriesData<{
pages: { items: EntityData[] }[];
diff --git a/apps/web/src/features/notifications/components/Playground.tsx b/apps/web/src/features/notifications/components/Playground.tsx
index c4b4a1c571..bd611ff0e3 100644
--- a/apps/web/src/features/notifications/components/Playground.tsx
+++ b/apps/web/src/features/notifications/components/Playground.tsx
@@ -4,6 +4,7 @@ import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownS
import { NotificationRenderer } from '@core/component/NotificationRenderer';
import { formatDate } from '@core/util/date';
import { NotificationRow } from '@entity';
+import { Telemetry } from '@macro-inc/observability';
import { Button } from '@ui';
import {
type Component,
@@ -151,7 +152,11 @@ function BrowserFormat(props: { notification: UnifiedNotification }) {
props.notification,
DefaultUserNameResolver,
DefaultDocumentNameResolver
- ).then(setBrowserNotif);
+ )
+ .then(setBrowserNotif)
+ .catch((error) =>
+ Telemetry.error(error, { surface: 'notifications-playground' })
+ );
} else {
setBrowserNotif(null);
}
@@ -589,6 +594,8 @@ function PlaygroundContent() {
},
} as PlatformNotificationState,
layoutManager
+ ).catch((error) =>
+ Telemetry.error(error, { surface: 'notifications-playground' })
);
};
diff --git a/apps/web/src/features/notifications/notification-navigation.ts b/apps/web/src/features/notifications/notification-navigation.ts
index f6e4557889..4e9b33573e 100644
--- a/apps/web/src/features/notifications/notification-navigation.ts
+++ b/apps/web/src/features/notifications/notification-navigation.ts
@@ -98,7 +98,9 @@ function openSplitIfNotOpen(
reportImmediateResult(result);
}
if (options.params && type !== 'component') {
- goToLocationInSplit(layoutManager, type, id, options.params);
+ goToLocationInSplit(layoutManager, type, id, options.params).catch(
+ (error) => Telemetry.error(error, { surface: 'notification-navigation' })
+ );
}
}
diff --git a/apps/web/src/features/notifications/notification-source.ts b/apps/web/src/features/notifications/notification-source.ts
index c3c17b5433..2467256a35 100644
--- a/apps/web/src/features/notifications/notification-source.ts
+++ b/apps/web/src/features/notifications/notification-source.ts
@@ -330,7 +330,7 @@ export function createNotificationSource(
if (usesGraphql()) return;
if (!notificationsQuery.data) return;
if (notificationsQuery.hasNextPage && !notificationsQuery.isFetching) {
- notificationsQuery.fetchNextPage();
+ void notificationsQuery.fetchNextPage();
}
});
diff --git a/apps/web/src/features/notifications/use-notification-updates.ts b/apps/web/src/features/notifications/use-notification-updates.ts
index 5d171bc8fd..9f6c280128 100644
--- a/apps/web/src/features/notifications/use-notification-updates.ts
+++ b/apps/web/src/features/notifications/use-notification-updates.ts
@@ -46,6 +46,14 @@ function refreshEmailThread(notification: UnifiedNotification) {
});
}
+async function refreshDeliveredEmailReminder(threadId: string) {
+ try {
+ await refreshEmailFollowup(threadId);
+ } catch (error) {
+ console.warn('Failed to refresh delivered email reminder', error);
+ }
+}
+
/**
* Applies domain cache updates for a connection-gateway notification.
*
@@ -126,13 +134,9 @@ export function handleNotificationUpdate(notification: UnifiedNotification) {
.with({ tag: 'new_email' }, () => {
refreshEmailThread(notification);
})
- .with({ tag: 'reminder' }, async () => {
+ .with({ tag: 'reminder' }, () => {
if (notification.entity_type !== 'email_thread') return;
- try {
- await refreshEmailFollowup(notification.entity_id);
- } catch (error) {
- console.warn('Failed to refresh delivered email reminder', error);
- }
+ void refreshDeliveredEmailReminder(notification.entity_id);
})
.with({ tag: 'inbox_reauth_required' }, () => {
invalidateEmailLinks();
diff --git a/apps/web/src/features/sharing/native-share-sheet/NativeShareSheet.tsx b/apps/web/src/features/sharing/native-share-sheet/NativeShareSheet.tsx
index 63d21d78d3..b55b7b575d 100644
--- a/apps/web/src/features/sharing/native-share-sheet/NativeShareSheet.tsx
+++ b/apps/web/src/features/sharing/native-share-sheet/NativeShareSheet.tsx
@@ -212,8 +212,8 @@ function NativeShareSheetComposer(props: { handleCancel: () => void }) {
const sendShare = createNativeShareSend<InputSnapshot>({
clear: async () => {
- invalidateListChannels();
- invalidateContacts();
+ void invalidateListChannels();
+ void invalidateContacts();
await shareTarget?.clearPendingShareFiles(batchTokens);
},
send: async (snapshot) => {
diff --git a/apps/web/src/features/team-invitations/invite-modal.tsx b/apps/web/src/features/team-invitations/invite-modal.tsx
index 34f75b35b2..7d4f810669 100644
--- a/apps/web/src/features/team-invitations/invite-modal.tsx
+++ b/apps/web/src/features/team-invitations/invite-modal.tsx
@@ -2,6 +2,7 @@ import { toast } from '@core/component/Toast/Toast';
import { useReferralCode } from '@core/context/user';
import { getWebOrigin } from '@core/util/webOrigin';
+import { Telemetry } from '@macro-inc/observability';
import ClipboardIcon from '@phosphor/clipboard.svg';
import CloseIcon from '@phosphor/x.svg';
import { authServiceClient } from '@service-auth/client';
@@ -16,6 +17,15 @@ function parseEmails(raw: string): string[] {
.filter((s) => s.includes('@'));
}
+async function addInvitedContact(email: string) {
+ const result = await contactsClient.addContact(
+ `macro|${email.toLowerCase()}`
+ );
+ if (result.isErr()) {
+ Telemetry.error(result.error, { surface: 'team-invitations' });
+ }
+}
+
const [inviteModalOpen, setInviteModalOpen] = createSignal(false);
export { setInviteModalOpen };
@@ -32,12 +42,19 @@ export const InviteModal = () => {
return `${getWebOrigin()}/app/signup?referral_code=${code}`;
};
+ const copyReferralUrl = async (url: string) => {
+ await navigator.clipboard.writeText(url);
+ setCopied(true);
+ setTimeout(() => setCopied(false), 2000);
+ };
+
const handleCopy = () => {
const url = referralUrl();
if (!url) return;
- navigator.clipboard.writeText(url);
- setCopied(true);
- setTimeout(() => setCopied(false), 2000);
+ copyReferralUrl(url).catch((error) => {
+ Telemetry.error(error, { surface: 'team-invitations' });
+ toast.failure('Failed to copy link');
+ });
};
const handleSend = async () => {
@@ -47,7 +64,7 @@ export const InviteModal = () => {
for (const email of emails) {
const result = await authServiceClient.sendReferralInvite(email);
if (result.isOk()) {
- contactsClient.addContact(`macro|${email.toLowerCase()}`);
+ void addInvitedContact(email);
}
}
setValue('');