Skip to content

fix(tool-input): sync cleared subblock values to tool params#3214

Merged
waleedlatif1 merged 1 commit intostagingfrom
fix/stale
Feb 13, 2026
Merged

fix(tool-input): sync cleared subblock values to tool params#3214
waleedlatif1 merged 1 commit intostagingfrom
fix/stale

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • sync cleared subblock values to tool params

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 13, 2026 8:17am

Request Review

@waleedlatif1 waleedlatif1 merged commit 7fbbc7b into staging Feb 13, 2026
7 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/stale branch February 13, 2026 08:18
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 13, 2026

Greptile Overview

Greptile Summary

Fixed a synchronization bug where clearing a subblock value wouldn't properly sync to tool parameters. The fix modifies the second useEffect to allow null store values to be converted to empty strings and pushed to params, as long as a previous value had been set. This ensures that when users clear input fields, the cleared state is properly reflected in the parent tool parameters.

Key changes:

  • Modified null check from if (storeValue == null) return to if (storeValue == null && lastPushedToParamsRef.current === null) return
  • Added ternary operator to convert null storeValue to empty string: storeValue == null ? '' : ...
  • Maintains correct behavior for initial mount (no unnecessary syncs when both values are null)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is a targeted 5-line change that addresses a specific synchronization bug with clear logic. The modification preserves existing behavior for initial mount scenarios while correctly handling the cleared value case. The change is well-contained, doesn't introduce new dependencies, and the logic is straightforward to verify.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/components/tools/sub-block-renderer.tsx Fixed bug where cleared subblock values were not synced to tool params by adjusting null check condition and converting null to empty string

Last reviewed commit: 3ff275d

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant