hyperdx/packages
Warren Lee c4a1311e86
Fix "Copy entire row as JSON" button TypeError on non-string values (#2116)
## Summary

Fixes an operator-precedence bug in the "Copy entire row as JSON" button on the Search page. The `typeof value === 'string'` guard only applied to `value.startsWith('{')` but not `value.startsWith('[')`, so when a row contained a non-string value (number, boolean, etc.) the second `startsWith` call threw:

```
TypeError: s.startsWith is not a function
```

The fix moves the `typeof` check to guard both `startsWith` calls:

```diff
- (typeof value === 'string' && value.startsWith('{')) ||
- value.startsWith('[')
+ typeof value === 'string' &&
+ (value.startsWith('{') || value.startsWith('['))
```

### How to test locally or on Vercel

1. Open any Search page with results containing non-string column values (e.g. numeric or boolean fields).
2. Hover over a row and click the "Copy entire row as JSON" button (copy icon).
3. Verify the row is copied as valid JSON to the clipboard without a console error.

### References

- Related issue: HDX-4023


<div><a href="https://cursor.com/agents/bc-7aa1e5f4-ced5-4ee0-9585-4f473c5fca69"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-7aa1e5f4-ced5-4ee0-9585-4f473c5fca69"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>



Co-authored-by: Cursor Agent <199161495+cursoragent@users.noreply.github.com>
2026-04-14 22:05:23 +00:00
..
api feat: integrate Model Context Protocol (MCP) server for dashboards & investigations (#2030) 2026-04-14 14:39:07 +00:00
app Fix "Copy entire row as JSON" button TypeError on non-string values (#2116) 2026-04-14 22:05:23 +00:00
cli [HDX-3964] Add event pattern mining to CLI (Shift+P) (#2106) 2026-04-14 18:03:56 +00:00
common-utils fix: Skip rendering empty SQL dashboard filter (#2115) 2026-04-14 20:04:58 +00:00
otel-collector [HDX-3929] Migrate OTel Collector build to use OCB (OpenTelemetry Collector Builder) (#2109) 2026-04-14 12:04:20 -07:00