fix(code-subblock): added validation to not parse non-variables as variables in the code subblock#1240
fix(code-subblock): added validation to not parse non-variables as variables in the code subblock#1240waleedlatif1 merged 4 commits intostagingfrom
Conversation
…riables in the code subblock
There was a problem hiding this comment.
Greptile Summary
This PR addresses two main issues: variable parsing bugs in code subblocks and dark mode styling problems across the UI. The core fix implements validation logic in the InputResolver (resolver.ts) to prevent non-variable patterns like comparison operators (<=, >=) and HTML-like tags from being incorrectly parsed as variable references. The new isValidVariableReference() method ensures only properly formatted variable references containing dots (e.g., <block.property>) are processed, preventing runtime errors and unintended variable substitution in user code.
The styling improvements span multiple components to fix dark mode visibility issues. The wand (AI generation) button styling is standardized across input components by changing hover text color from text-primary to text-foreground, ensuring proper contrast in dark themes. The wand prompt bar positioning is updated from absolute top positioning to bottom-full positioning, making it appear above trigger elements with better visual hierarchy. Additionally, the code editor replaces custom HTML buttons with standardized Button components for consistency.
The PR also removes JSON validation UI indicators from the code subblock component while preserving the underlying validation logic. This prevents non-JSON content (like JavaScript or Python) from being incorrectly flagged with red borders and error tooltips. The custom tool modal receives UX improvements by replacing text-based error display with icon-based tooltips using the AlertTriangle icon.
These changes work together to create a more robust variable parsing system while ensuring consistent, theme-aware UI behavior across the workflow editor components.
7 files reviewed, 1 comment
| <AlertTriangle className='h-4 w-4 cursor-pointer text-destructive' /> | ||
| </TooltipTrigger> | ||
| <TooltipContent side='top'> | ||
| <p>Invalid JSON</p> |
There was a problem hiding this comment.
style: Consider making the tooltip message more specific to the actual error type rather than generic 'Invalid JSON'
…ed available blocks, not block ID's
…riables in the code subblock (simstudioai#1240) * fix(code-subblock): added validation to not parse non-variables as variables in the code subblock * fix wand prompt bar styling * fix error message for available connected blocks to only show connected available blocks, not block ID's * ui
Summary
added validation to not parse non-variables as variables in the code subblock, fixed styling of wand prompt bar and icons not visible in dark mode
Type of Change
Testing
Tested manually.
Checklist
Screenshots/Videos
Before:

After:
