Skip to content

fix(blocks): allow tool expansion in disabled mode, improve child deploy badge freshness#4002

Merged
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/fix-tool-input-expand-deploy
Apr 7, 2026
Merged

fix(blocks): allow tool expansion in disabled mode, improve child deploy badge freshness#4002
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/fix-tool-input-expand-deploy

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Allow expanding tool-input tools in read-only/locked mode (view-only, uses local state instead of writing to store)
  • Add refetchOnMount: 'always' to child workflow deploy badges so deployment status is fresh on navigation
  • Extend useDeploymentInfo options to accept refetchOnMount

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
Copy Markdown

vercel bot commented Apr 7, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 7, 2026 1:14am

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 7, 2026

PR Summary

Low Risk
Low risk UI/query-behavior change; main impact is extra refetches on navigation and local-only expansion state when the editor is read-only.

Overview
Improves workflow/tool UI behavior in read-only contexts and makes deploy status badges more reliable after navigation.

Tool cards in tool-input can now be expanded/collapsed even when disabled, using local component state instead of writing isExpanded back to the store. Deployment badges for embedded workflow tools and child workflow selector blocks now call useDeploymentInfo with refetchOnMount: 'always', supported by a new optional refetchOnMount passthrough in the useDeploymentInfo hook.

Reviewed by Cursor Bugbot for commit 95e5a2f. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 7, 2026

Greptile Summary

This PR delivers two focused bug fixes: (1) tool-input panels can now be expanded in disabled/locked (read-only) mode using local component state, without writing back to the Zustand store; and (2) refetchOnMount: 'always' is added to deployment info queries for child workflow badges so they display fresh deployment status on every navigation rather than serving stale cache.

Key changes:

  • deployments.tsuseDeploymentInfo options now accept refetchOnMount?: boolean | 'always', applied via conditional spread so TanStack Query's default is preserved when the option is omitted.
  • use-child-workflow.ts — passes { refetchOnMount: 'always' } so the child workflow deploy badge is always fresh on mount.
  • tool-input.tsx — renames previewExpandedlocalExpanded, drops the early-return for disabled mode in toggleToolExpansion, and reads localExpanded for display whenever isPreview || disabled, keeping the store unmodified in read-only contexts.

Confidence Score: 5/5

Safe to merge — no bugs found, changes are well-scoped and correctly implemented.

All three changes are clean, minimal bug fixes. The disabled-mode expansion correctly isolates state to local component state and never writes to the store. The refetchOnMount: 'always' pattern is idiomatic TanStack Query v5 usage for ensuring freshness on mount. No logic errors, security concerns, or regressions identified.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/hooks/queries/deployments.ts Extends useDeploymentInfo options to accept refetchOnMount; applies it via conditional spread to avoid overriding TanStack Query defaults when not provided.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/hooks/use-child-workflow.ts Passes { refetchOnMount: 'always' } so the child workflow deploy badge shows fresh deployment status on every mount.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx Renames previewExpanded → localExpanded, removes disabled early-return guard, routes expansion display through localExpanded when isPreview

Sequence Diagram

sequenceDiagram
    participant U as User
    participant TI as ToolInput
    participant LS as LocalState (useState)
    participant ST as Zustand Store
    participant API as /api/workflows/{id}/deploy

    U->>TI: clicks expand (disabled mode)
    TI->>TI: isPreview || disabled? YES
    TI->>LS: setLocalExpanded(toolIndex, toggled)
    Note over ST: Store unchanged

    U->>TI: clicks expand (edit mode)
    TI->>TI: isPreview || disabled? NO
    TI->>ST: setStoreValue(tools with isExpanded toggled)

    U->>TI: navigates to workflow (component mounts)
    TI->>API: fetch with refetchOnMount: 'always'
    API-->>TI: fresh deployment status
    TI->>TI: display up-to-date badge
Loading

Reviews (2): Last reviewed commit: "fix(blocks): allow tool expansion in dis..." | Re-trigger Greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 95e5a2f. Configure here.

@waleedlatif1 waleedlatif1 merged commit 8df3f20 into staging Apr 7, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/fix-tool-input-expand-deploy branch April 7, 2026 01:33
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