fix(DataMapper): Preserve sibling variable after choice - #3594
Conversation
📝 WalkthroughWalkthrough
ChangesMapping cleanup
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/ui/src/services/mapping/mapping.service.test.ts (1)
668-670: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert that cleanup retains the original
VariableIteminstance.The current
find()check passes if cleanup replacesvariablewith a new item that has the same name. Assert reference identity so the test detects loss ofVariableItemstate.Proposed assertion
- const retained = parentItem.children.find((c) => c instanceof VariableItem && c.name === 'myVar'); - expect(retained).toBeDefined(); + expect(parentItem.children).toContain(variable); + expect(variable.parent).toBe(parentItem);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui/src/services/mapping/mapping.service.test.ts` around lines 668 - 670, Update the cleanup assertion in the test around parentItem.children to verify that the retained entry is the original VariableItem instance, not merely an item with the same name; capture or reuse the pre-cleanup variable reference and assert reference identity while preserving the existing children-length check.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/ui/src/services/mapping/mapping.service.test.ts`:
- Around line 668-670: Update the cleanup assertion in the test around
parentItem.children to verify that the retained entry is the original
VariableItem instance, not merely an item with the same name; capture or reuse
the pre-cleanup variable reference and assert reference identity while
preserving the existing children-length check.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 599809fc-8170-4363-8a99-4e18ad25d189
📒 Files selected for processing (2)
packages/ui/src/services/mapping/mapping.service.test.tspackages/ui/src/services/mapping/mapping.service.ts
igarashitm
left a comment
There was a problem hiding this comment.
Fix LGTM 👍
However the screencast reveals a bug, when choice selection is made to dataValue after variable creation, the dataValue node gets an expand button at left despite of being string leaf field. Could you either:
- Fix it together if it's trivial
- File an issue otherwise
|
Also, this assertion improvement sounds nice to have and low hanging - #3594 (review) |
|
Verified this "expand button on leaf field" issue reproduces without variable creation #3594 (review) Interestingly, if I reproduce it after creating a variable, then remove the variable, the button disappears. |



Resolves: #3452
Screen.Recording.2026-07-31.at.10.49.11.mov
Summary by CodeRabbit
Bug Fixes
Tests