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(web): report DisplayResults render errors to telemetry (#7163)
Wolf Mermelstein05a56719ec9f
diff --git a/apps/web/src/features/block-agent/component/parts/DisplayResultsToolCall.test.tsx b/apps/web/src/features/block-agent/component/parts/DisplayResultsToolCall.test.tsxindex 439ef281c9..8ca2ba9475 100644--- a/apps/web/src/features/block-agent/component/parts/DisplayResultsToolCall.test.tsx+++ b/apps/web/src/features/block-agent/component/parts/DisplayResultsToolCall.test.tsx@@ -18,12 +18,18 @@ vi.mock('@app/features/dynamic-ui/DashboardToolView.lazy', async () => ({vi.mock('@app/features/dynamic-ui/widget', () => ({Widget: {- Compose: (props: { view: View }) => (- <div data-testid="dashboard">{JSON.stringify(props.view)}</div>- ),+ Compose: (props: { view: View }) => {+ if (props.view.title === 'throws') throw new TypeError('render failed');+ return <div data-testid="dashboard">{JSON.stringify(props.view)}</div>;+ },},}));+const telemetryError = vi.hoisted(() => vi.fn());+vi.mock('@macro-inc/observability', () => ({+ Telemetry: { error: telemetryError },+}));+vi.mock('@core/component/LexicalMarkdown/component/core/StaticMarkdown',() => ({@@ -145,4 +151,20 @@ describe('DisplayResultsToolCall', () => {);expect(rendered.container.querySelector('.magic-chip-shimmer')).toBeNull();});++ it('reports a render error before showing the fallback', () => {+ const rendered = render(() => (+ <DisplayResultsToolCall+ input={{ view: { title: 'throws', widgets: [] } }}+ common={common()}+ />+ ));++ expect(rendered.container.textContent).toContain(+ 'Unable to display these results.'+ );+ expect(telemetryError).toHaveBeenCalledWith(expect.any(TypeError), {+ surface: 'display-results',+ });+ });});diff --git a/apps/web/src/features/block-agent/component/parts/DisplayResultsToolCall.tsx b/apps/web/src/features/block-agent/component/parts/DisplayResultsToolCall.tsxindex 6069b82eb6..7612943bca 100644--- a/apps/web/src/features/block-agent/component/parts/DisplayResultsToolCall.tsx+++ b/apps/web/src/features/block-agent/component/parts/DisplayResultsToolCall.tsx@@ -1,6 +1,7 @@/** DisplayResults is message content, rendered directly from the call's view. */import { DashboardToolView } from '@app/features/dynamic-ui/DashboardToolView.lazy';+import { Telemetry } from '@macro-inc/observability';import { ErrorBoundary, Show, Suspense } from 'solid-js';import { isToolActive, ToolCard } from '../../ui';import type { ToolCallCommon } from './shared';@@ -39,7 +40,12 @@ export function DisplayResultsToolCall(props: {/>}>- <ErrorBoundary fallback={unavailable()}>+ <ErrorBoundary+ fallback={(err) => {+ Telemetry.error(err, { surface: 'display-results' });+ return unavailable();+ }}+ ><Suspensefallback={<Show when={!pending()}>diff --git a/apps/web/src/features/dynamic-ui/render.tsx b/apps/web/src/features/dynamic-ui/render.tsxindex 65333f8d0e..083120189c 100644--- a/apps/web/src/features/dynamic-ui/render.tsx+++ b/apps/web/src/features/dynamic-ui/render.tsx@@ -1,3 +1,4 @@+import { Telemetry } from '@macro-inc/observability';import { createMemo, ErrorBoundary, For, type JSX, Suspense } from 'solid-js';import { match } from 'ts-pattern';import { Col, Row, View } from './core/Layout';@@ -114,11 +115,19 @@ function RowLayout(props: { node: WidgetOf<'container'> }): JSX.Element {export function Compose(props: { view: ComposedView }): JSX.Element {return (<ErrorBoundary- fallback={(err) => (- <div class="border-edge-muted text-ink-extra-muted rounded border border-dashed p-3 text-xs">- Failed to render view: {String(err)}- </div>- )}+ fallback={(err) => {+ Telemetry.error(err, {+ surface: 'dynamic-ui',+ widgetTypes: props.view.widgets+ .map((widget) => widget.type)+ .join(','),+ });+ return (+ <div class="border-edge-muted text-ink-extra-muted rounded border border-dashed p-3 text-xs">+ Failed to render view: {String(err)}+ </div>+ );+ }}><Suspensefallback={<div class="text-ink-muted p-3 text-sm">Loading…</div>}