sim
sim copied to clipboard
Fix: Handle object rendering in UI
Summary
- Fixes #2725 - React crashes when rendering workflow output objects
- Adds robust utility to safely format various output types
- Prevents UI crashes when nodes return structured objects like
{text, type}
Changes
- Created
format-output.tsutility with deep object traversal - Updated chat components to use the new formatting utility
- Added comprehensive unit tests
- Handles edge cases: circular refs, nested objects, arrays, XSS protection
Test Plan
- [x] Tested with LLM outputs returning
{text: "content", type: "response"} - [x] Tested with nested objects and arrays
- [x] Verified no React rendering errors
- [x] Unit tests cover all scenarios