Skip to content

Conversation

@icecrasher321
Copy link
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
Copy link

vercel bot commented Nov 12, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Nov 12, 2025 5:44am

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 12, 2025

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

Filename Score Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/hooks/use-editor-block-properties.ts 5/5 Updated 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.ts 5/5 Modified to use diff workflow blocks and values when in diff mode, ensuring subblocks display correctly
apps/sim/lib/copilot/tools/server/workflow/edit-workflow.ts 5/5 Added 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

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.

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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

2 participants