Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Description

Fix bug where user can't edit if container when else if is added

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Tested manually

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally and in CI (bun run test)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • I have updated version numbers as needed (if needed)
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Security Considerations:

  • My changes do not introduce any new security vulnerabilities
  • I have considered the security implications of my changes

Additional Information:

Before:

Screen.Recording.2025-07-22.at.9.21.18.PM.mov

After:

Screen.Recording.2025-07-22.at.9.22.09.PM.mov

@vercel
Copy link

vercel bot commented Jul 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sim 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jul 23, 2025 4:22am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Skipped (Inspect) Jul 23, 2025 4:22am

@waleedlatif1 waleedlatif1 merged commit fe82166 into staging Jul 23, 2025
3 of 4 checks passed
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 Summary

This PR fixes a critical bug in the ConditionInput component where users couldn't edit 'if' container blocks after adding 'else if' blocks. The root cause was that the DOM reference (editorRef) was attached to an inner div scoped to individual conditional blocks rather than the outer container that encompasses all blocks.

The fix involves two key changes:

  1. Ref relocation: Moving the ref from line 645 (inner block div) to line 514 (outer container div) and renaming it from editorRef to containerRef for clarity
  2. Query selector updates: Updating all DOM queries throughout the component to use the new container reference with block-specific selectors like [data-block-id="${blockId}"] textarea

This change ensures that DOM manipulation functions (focus management, cursor positioning, keyboard event handling) work correctly across all conditional blocks regardless of the component's dynamic structure. The ConditionInput component manages conditional logic blocks with 'if', 'else if', and 'else' functionality, and this fix ensures consistent editability as users add more conditional branches to their workflows.

Confidence score: 5/5

  • This is a well-targeted bug fix that addresses a specific DOM scoping issue without breaking existing functionality
  • The solution correctly moves the DOM reference to the appropriate container level and updates all related queries consistently
  • No files need additional attention as the changes are contained and the fix directly addresses the reported issue

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

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