Commit cd0f898
authored
fix(ui): Handle null/undefined span.description safely (#1239)
## Summary
Fix runtime error when calling `.trim()` on non-string
`span.description` values.
## Root Cause
The `Span.description` property is typed as `string | null | undefined`.
The previous code used `String(span?.description).trim()` which
converts:
- `null` → `"null"` (literal string)
- `undefined` → `"undefined"` (literal string)
These incorrect values passed through the `.delete("")` cleanup and
appeared as valid queries/resources.
## Fix
Use nullish coalescing (`??`) to return an empty string for
`null`/`undefined`, which the existing cleanup handles correctly:
```typescript
// Before
String(span?.description).trim()
// After
(span.description ?? "").trim()
```
Fixes SPOTLIGHT-ELECTRON-4V1 parent b621b56 commit cd0f898
File tree
2 files changed
+2
-2
lines changed- packages/spotlight/src/ui/telemetry/components/insights
2 files changed
+2
-2
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
0 commit comments