refactor(tool-input): replace bidirectional effects with zustand subscription#3215
Merged
waleedlatif1 merged 3 commits intostagingfrom Feb 14, 2026
Merged
refactor(tool-input): replace bidirectional effects with zustand subscription#3215waleedlatif1 merged 3 commits intostagingfrom
waleedlatif1 merged 3 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile OverviewGreptile SummaryThis PR is a multi-part change that combines: (1) a refactor of
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User as User Input
participant SBR as ToolSubBlockRenderer
participant SBS as useSubBlockStore
participant TI as ToolInput (handleParamChange)
Note over SBR: Mount: seed effect runs
SBR->>SBS: getState().setValue(blockId, syntheticId, toolParamValue)
SBS-->>SBR: subscribe callback fires (newVal !== oldVal)
SBR->>SBR: syncedRef guards against echo (stringified === syncedRef)
Note over User: User types in SubBlock
User->>SBS: SubBlock writes via setValue()
SBS-->>SBR: subscribe callback fires synchronously
SBR->>SBR: Stringify value, check syncedRef
SBR->>TI: onParamChangeRef.current(toolIndex, paramId, stringified)
TI->>TI: Updates tool.params[paramId]
Note over TI: External param change (e.g. wand)
TI->>SBR: toolParamValue prop changes
SBR->>SBR: Seed effect: syncedRef = toolParamValue
SBR->>SBS: getState().setValue(blockId, syntheticId, parsed)
SBS-->>SBR: subscribe fires, syncedRef guards echo
Last reviewed commit: d74031c |
...ts/editor/components/sub-block/components/tool-input/components/tools/sub-block-renderer.tsx
Show resolved
Hide resolved
Collaborator
Author
|
@cursor review |
Collaborator
Author
|
@cursor review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ToolSubBlockRendererwith a raw Zustand subscription + seed effect + two refsstoreSyncReadyhackuseSubBlockValuedependency — uses raw store access since SubBlock creates its own hook internallyType of Change
Testing
Tested manually
Checklist