Skip to content

Conversation

@Sg312
Copy link
Contributor

@Sg312 Sg312 commented Sep 29, 2025

Summary

Fixes copilot diff store not loading diff

Type of Change

  • Bug fix

Testing

Manual

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 Sep 29, 2025

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

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Sep 29, 2025 7:57pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 29, 2025 7:57pm

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.

Greptile Overview

Summary

This PR fixes the copilot diff store loading issue by simplifying workflow loading conditions and removing automatic layout positioning.

Key Changes:

  • Simplified loading logic: Removed lastSaved dependency from skeleton UI display conditions - now only relies on isWorkflowReady
  • Streamlined TriggerList rendering: Removed lastSaved check from empty workflow trigger display logic
  • Removed auto-layout: Eliminated automatic layout positioning API call from workflow building process

The changes address a specific bug where the diff store wasn't loading properly, likely due to complex loading conditions that were preventing proper state hydration. The removal of lastSaved checks suggests this property was causing timing issues in the loading sequence.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - contains targeted bug fixes
  • The changes are well-scoped bug fixes that simplify loading logic and remove potentially problematic auto-layout functionality. No breaking changes or complex logic introduced.
  • No files require special attention - changes are straightforward simplifications

Important Files Changed

File Analysis

Filename        Score        Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx 4/5 Simplified loading conditions by removing lastSaved dependency in skeleton UI and TriggerList rendering
apps/sim/lib/copilot/tools/server/workflow/build-workflow.ts 4/5 Removed automatic layout positioning logic that fetches smart layout from external API

Sequence Diagram

sequenceDiagram
    participant User as User
    participant WF as WorkflowContent
    participant Store as WorkflowStore
    participant Copilot as BuildWorkflowTool
    participant API as SIM_AGENT_API

    Note over WF,Store: Before Fix: Complex Loading Logic
    User->>WF: Load Workflow Page
    WF->>Store: Check isWorkflowReady
    WF->>Store: Check lastSaved !== 'number'
    Note over WF: showSkeletonUI = !isWorkflowReady || typeof lastSaved !== 'number'
    alt lastSaved not a number
        WF->>User: Show Skeleton UI
    else Both conditions met
        WF->>User: Show TriggerList
    end

    Note over WF,API: After Fix: Simplified Logic
    User->>WF: Load Workflow Page
    WF->>Store: Check isWorkflowReady only
    Note over WF: showSkeletonUI = !isWorkflowReady
    alt Workflow not ready
        WF->>User: Show Skeleton UI
    else Workflow ready
        WF->>User: Show TriggerList (when empty)
    end

    Note over Copilot,API: Copilot Workflow Building
    User->>Copilot: Build Workflow Request
    Copilot->>Copilot: Validate workflow state
    Note over Copilot,API: Removed: Auto-layout positioning
    Note over API: X Layout API call removed
    Copilot->>User: Return workflow state (without positioning)
Loading

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@Sg312 Sg312 merged commit 3334429 into staging Sep 29, 2025
9 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/copilot-diff branch October 7, 2025 23:22
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