fix(Label): reset edit state when canceling with escape - #12649
Conversation
Signed-off-by: Mohamed Fall <ps.hackmaster@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughThe editable label now resets its controlled value when Escape cancels editing. Tests verify that discarded drafts do not reappear and that ChangesEditable label Escape cancellation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to Escape cancellation now restores the original label text and the changed behavior is covered by tests. 🚥 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 |
What: Closes #12648
Pressing Escape during an inline label edit reverts the displayed text, but reopening the editor brings back the discarded draft.
The edit input is controlled by
currValue, and the Escape handler was resetting the DOM node directly:That has no effect on a controlled input, so
currValuekept the draft. The fix resets the state instead:This runs unconditionally, which also covers the case where the input is cleared before pressing Escape. Previously
currValuestayed''while the label displayed the original text.onEditCancelkeeps its existing guard, so the callback behavior is unchanged.Added two tests: reopening the editor after Escape shows the original text, and
onEditCancelreceives the previous text. No snapshot changes.Additional issues: None
Summary by CodeRabbit