Loading
Keep comment text when editing its line range
What does this MR do?
Fixes a bug in Rapid Diffs where editing a multi-line comment's line range wiped out the text you'd already typed. The form restored its text from the saved draft, which is keyed by the range's last line, so a new last line meant an empty box. The form now opens with the text the store already carries across the range edit, and each form retires its own draft when it's removed. Drafts are left to do one job: restore the form after a page reload.
References
Screenshots or screen recordings
| Before | After |
|---|---|
Reproduction steps
- Open a merge request's Changes tab with Rapid Diffs.
- Drag across several lines to start a multi-line comment.
- Type some text into the comment box.
- Click the pencil icon (Edit line range) in the form header.
- Drag a handle so the last line of the range changes, then release.
- Expected: the text is still in the comment box.
- Edit the range back to the original last line.
- Expected: the box still shows the current text, not an old stale copy.
Edited by Stanislav Lashmanov