Skip to content

fix(copilot): show subblocks in diff mode - #1916

Merged
icecrasher321 merged 1 commit into
stagingfrom
fix/copilot-subblock-view
Nov 12, 2025
Merged

fix(copilot): show subblocks in diff mode#1916
icecrasher321 merged 1 commit into
stagingfrom
fix/copilot-subblock-view

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

In diff mode, must still show subblocks in the sidebar. This PR fixes that.

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

vercelBot commented Nov 12, 2025

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentPreviewCommentsUpdated (UTC)
docsSkippedSkippedNov 12, 2025 5:44am

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR fixes a bug where subblocks were not displaying in the editor sidebar when viewing workflows in diff mode. The fix ensures that when isDiffMode is true, the editor hooks fetch block properties and subblock data from the diff workflow store instead of the normal workflow store.

Key changes:

  • Modified useEditorBlockProperties and useEditorSubblockLayout hooks to accept an isDiffMode parameter
  • When in diff mode, hooks now retrieve blocks from useWorkflowDiffStore instead of useWorkflowStore
  • Updated value prioritization logic: in diff mode, diff workflow values take precedence; in normal mode, live store values are used
  • Added scheduleId to TRIGGER_RUNTIME_SUBBLOCK_IDS constant
  • Added filtering in edit-workflow.ts to skip runtime subblock IDs when processing inputs

Additional improvements:

  • The copilot workflow editing logic now properly excludes runtime metadata (scheduleId, webhookId, etc.) from being modified during programmatic edits

Confidence Score: 5/5

  • This PR is safe to merge with no concerns
  • The changes are well-structured, logically sound, and properly address the stated bug. The implementation correctly handles the diff mode flag throughout the data flow chain, and the additional runtime ID filtering prevents unintended side effects in copilot operations
  • No files require special attention

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/hooks/use-editor-block-properties.ts5/5Updated to fetch block properties from diff workflow when in diff mode
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/hooks/use-editor-subblock-layout.ts5/5Modified to use diff workflow blocks and values when in diff mode, ensuring subblocks display correctly
apps/sim/lib/copilot/tools/server/workflow/edit-workflow.ts5/5Added filtering to skip runtime subblock IDs when processing inputs in multiple functions

Sequence Diagram

sequenceDiagram
participant Editor as Editor Component
participant BlockProps as useEditorBlockProperties
participant SubblockLayout as useEditorSubblockLayout
participant WorkflowStore as Workflow Store
participant DiffStore as Workflow Diff Store
Editor->>Editor: Check currentWorkflow.isDiffMode
alt isDiffMode = true
Editor->>BlockProps: useEditorBlockProperties(blockId, true)
BlockProps->>DiffStore: Get diffWorkflow
DiffStore-->>BlockProps: Return diff workflow blocks
BlockProps-->>Editor: Return advancedMode, triggerMode from diff
Editor->>SubblockLayout: useEditorSubblockLayout(..., true)
SubblockLayout->>DiffStore: Get diffWorkflow blocks
DiffStore-->>SubblockLayout: Return diff blocks
SubblockLayout->>SubblockLayout: Merge subblock state from diff
SubblockLayout->>SubblockLayout: Prioritize diff workflow values
SubblockLayout-->>Editor: Return subBlocks from diff
else isDiffMode = false
Editor->>BlockProps: useEditorBlockProperties(blockId, false)
BlockProps->>WorkflowStore: Get blocks
WorkflowStore-->>BlockProps: Return normal blocks
BlockProps-->>Editor: Return advancedMode, triggerMode
Editor->>SubblockLayout: useEditorSubblockLayout(..., false)
SubblockLayout->>WorkflowStore: Get blocks
WorkflowStore-->>SubblockLayout: Return normal blocks
SubblockLayout->>SubblockLayout: Merge with live store values
SubblockLayout-->>Editor: Return subBlocks
end
Editor->>Editor: Render subblocks in sidebar
Loading

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321
icecrasher321 merged commit 5cea73f into stagingNov 12, 2025
9 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/copilot-subblock-view branch November 12, 2025 15:39
@waleedlatif1waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
Sign up for freeto 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

@icecrasher321