-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix: prevent React error #31 when rendering workflow output objects #2972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: prevent React error #31 when rendering workflow output objects #2972
Conversation
|
@wingding12 is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR introduces a defensive utility function Changes:
Observations:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant WF as Workflow/Node Output
participant Store as Store (notifications/copilot)
participant Component as UI Component
participant Util as safelyRenderValue()
participant React as React Renderer
Note over WF,React: Before PR (causes crash)
WF->>Store: output = {text: "hello", type: "text"}
Store->>Component: notification.message = object
Component->>React: render object directly
React-->>Component: ❌ Error #31: Objects are not valid as React child
Note over WF,React: After PR (safe rendering)
WF->>Store: output = {text: "hello", type: "text"}
Store->>Component: notification.message = object
Component->>Util: safelyRenderValue(object)
Util->>Util: JSON.stringify(object)
Util-->>Component: '{"text":"hello","type":"text"}'
Component->>React: render string
React-->>Component: ✅ Renders successfully
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 1 comment
36009f9 to
af78728
Compare
…t objects Add safelyRenderValue utility function to handle objects, arrays, and other non-primitive types that could be rendered directly in React components. Applied to: - queued-messages.tsx: msg.content - notifications.tsx: notification.message - todo-list.tsx: todo.content Fixes simstudioai#2725
20cbe02 to
083fc72
Compare
|
sorry for the messy commits, i had a gpg and email mismatch i've been racking my head to fix. hope they can be squashed cleanly! |
Summary
add safelyRenderValue utility function to handle objects, arrays, and other non-primitive types that could be rendered directly in React components
applied to:
Fixes #2725
Type of Change
Testing
no need for testing, just needed to correctly handle all value types
Checklist