fix(tool-input): sync cleared subblock values to tool params#3214
fix(tool-input): sync cleared subblock values to tool params#3214waleedlatif1 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryFixed a synchronization bug where clearing a subblock value wouldn't properly sync to tool parameters. The fix modifies the second Key changes:
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 3ff275d |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| ? '' | ||
| : typeof storeValue === 'string' | ||
| ? storeValue | ||
| : JSON.stringify(storeValue) |
There was a problem hiding this comment.
Initial mount briefly clears existing tool param values
Medium Severity
On initial mount with existing non-empty tool params, the second useEffect incorrectly clears the param to ''. The first effect runs and sets lastPushedToParamsRef.current to the existing param value (e.g. "hello") via a synchronous ref mutation. The second effect then sees storeValue still as null (stale from the current render) but lastPushedToParamsRef.current is no longer null, so the guard on line 81 doesn't return early. It converts null to '' and pushes that to params via onParamChange. The value self-corrects on the next render cycle, but this creates an unnecessary clear-then-restore round-trip and extra re-renders.


Summary
Type of Change
Testing
Tested manually
Checklist