diff --git a/apps/start/src/components/ui/key-value-grid.tsx b/apps/start/src/components/ui/key-value-grid.tsx index 213ac9736..01180dd42 100644 --- a/apps/start/src/components/ui/key-value-grid.tsx +++ b/apps/start/src/components/ui/key-value-grid.tsx @@ -28,6 +28,35 @@ interface KeyValueGridProps { copyable?: boolean; } +/** + * The value cell truncates, so the full value is only reachable through the native + * tooltip and the copy button. Both need a string, and objects render as JSON here, + * so stringify them rather than leaving the value unreadable. + */ +export function toStringValue(value: unknown): string | undefined { + if (value === null || value === undefined) { + return undefined; + } + + if (typeof value === 'string') { + return value; + } + + if (value instanceof Date) { + return value.toISOString(); + } + + if (typeof value === 'object') { + try { + return JSON.stringify(value); + } catch { + return undefined; + } + } + + return String(value); +} + export function KeyValueGrid({ data, columns = 1, @@ -80,7 +109,10 @@ export function KeyValueGrid({
- {data.map((item, index) => ( + {data.map((item, index) => { + const stringValue = toStringValue(item.value); + + return (
- {copyable && ( + {copyable && stringValue !== undefined && (
- ))} + ); + })} {data.length === 0 && (
diff --git a/apps/start/src/modals/event-details.tsx b/apps/start/src/modals/event-details.tsx index 5b0833096..31d8875c1 100644 --- a/apps/start/src/modals/event-details.tsx +++ b/apps/start/src/modals/event-details.tsx @@ -286,6 +286,7 @@ function EventDetailsContent({ id, createdAt, projectId }: Props) { {propertiesMode === 'table' && ( { popModal(); @@ -310,6 +311,7 @@ function EventDetailsContent({ id, createdAt, projectId }: Props) {
{ const isFilterable = item.value && (filterable as any)[item.name];