Skip to content

Comments

fix(copy): preserve block names when pasting into workflows without conflicts#3315

Merged
waleedlatif1 merged 1 commit intostagingfrom
fix/copy
Feb 23, 2026
Merged

fix(copy): preserve block names when pasting into workflows without conflicts#3315
waleedlatif1 merged 1 commit intostagingfrom
fix/copy

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Preserve original block names when pasting into a workflow with no naming conflicts
  • Previously blocks always got " 1" appended (e.g., "Pages" → "Pages 1") even when no conflict existed
  • Added comprehensive tests for name preservation and conflict detection

Type of Change

  • Bug fix

Testing

  • Added 9 new test cases covering happy path and edge cases
  • All 43 tests passing

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

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 23, 2026 11:30pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 23, 2026

Greptile Summary

Fixed block naming behavior when pasting blocks into workflows. Previously, blocks always received a " 1" suffix (e.g., "Pages" → "Pages 1") even when no naming conflicts existed. Now preserves original names when no conflicts are detected, only applying getUniqueBlockName when actual collisions occur.

Changes:

  • Added conflict detection check using normalizeName for case-insensitive comparison
  • Preserves original block names when no conflicts exist in destination workflow
  • Maintains correct collision handling when conflicts do occur
  • Added 9 test cases covering happy path, edge cases, and collision scenarios

The fix correctly handles:

  • Blocks without conflicts (preserves original name)
  • Exact name matches (increments number)
  • Case-insensitive conflicts (e.g., "api 1" vs "API 1")
  • Multiple blocks with same name in paste set (prevents self-collision)

Confidence Score: 5/5

  • Safe to merge with no risk
  • Simple, focused bug fix with comprehensive test coverage (9 new tests). Logic is straightforward and correctly preserves names when no conflicts exist while maintaining proper collision handling
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/stores/workflows/utils.ts Fixed block naming logic to preserve original names when no conflicts exist, preventing unnecessary " 1" suffix
apps/sim/stores/workflows/utils.test.ts Added 9 comprehensive test cases covering name preservation, conflict detection, case-insensitivity, and edge cases

Last reviewed commit: cc801f0

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.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit b8dfb4d into staging Feb 23, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/copy branch February 23, 2026 23:42
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