Skip to content

fix(import): preserve workflow colors during import - #3130

Merged
waleedlatif1 merged 2 commits into
stagingfrom
improvement/colors
Feb 4, 2026
Merged

fix(import): preserve workflow colors during import#3130
waleedlatif1 merged 2 commits into
stagingfrom
improvement/colors

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Pass workflow color directly during creation instead of patching after
  • Removes unreliable PATCH call that was skipped for default blue color

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 Feb 4, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
docsSkippedSkippedFeb 4, 2026 4:11am

Request Review

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR fixes workflow color preservation during import by passing the color directly to the workflow creation API instead of using a separate PATCH request afterward.

Changes:

  • Removed conditional PATCH call that only ran when color wasn't the default blue (#3972F6)
  • Added color parameter to the createWorkflowMutation.mutateAsync() call
  • Ensures all workflow colors are preserved during import, not just non-default ones

Impact:

  • Eliminates unreliable PATCH call that was skipped for default blue workflows
  • Simplifies code by reducing API calls from 2 to 1 per workflow import
  • Fixes bug where default blue color wasn't being preserved properly

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The change is straightforward and well-aligned with the existing API contract - the useCreateWorkflow hook already accepts a color parameter, making this a simple refactor that eliminates an unnecessary PATCH call and fixes a bug
  • No files require special attention

Important Files Changed

FilenameOverview
apps/sim/app/workspace/[workspaceId]/w/hooks/use-import-workflow.tsSimplified workflow import by passing color directly to creation API instead of separate PATCH call

Sequence Diagram

sequenceDiagram
participant User
participant ImportHook as useImportWorkflow
participant CreateMutation as createWorkflowMutation
participant API as /api/workflows
participant StateAPI as /api/workflows/{id}/state
User->>ImportHook: Import workflow file
ImportHook->>ImportHook: Parse workflow JSON
ImportHook->>ImportHook: Extract color from metadata
Note over ImportHook: Before: color passed via PATCH<br/>After: color passed directly
ImportHook->>CreateMutation: mutateAsync({color, ...})
CreateMutation->>API: POST /api/workflows<br/>{name, color, workspaceId, ...}
API-->>CreateMutation: {id, name, color, ...}
CreateMutation-->>ImportHook: result with workflow id
rect rgb(240, 255, 240)
Note over ImportHook: Removed: PATCH call<br/>if color !== '#3972F6'
end
ImportHook->>StateAPI: PUT /api/workflows/{id}/state
StateAPI-->>ImportHook: Success
ImportHook-->>User: Workflow imported with correct color
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.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

@cursorcursorBot left a comment

Copy link
Copy Markdown

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

@waleedlatif1
waleedlatif1 merged commit 0a08ac0 into stagingFeb 4, 2026
12 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement/colors branch February 4, 2026 04:18
royceP2 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Mar 3, 2026
* fix(import): preserve workflow colors during import
* cleanup
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

@waleedlatif1