When localStorage draft exists for comment reply, show it on load
What does this MR do and why?
When a user has a comment draft saved in localstorage, we do not indicate that on page load at all; the user can only see their comment draft by clicking reply and seeing the draft populated into the markdown editor.
This MR changes the noteable_discussion component's behavior such that it exposes the markdown editor with the user's comment draft on page load if there is a saved draft for the comment in localstorage.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Scenario | Before | After |
---|---|---|
User has draft of top level comment and reloads page | ![]() |
![]() (no change) |
User has draft of reply comment and reloads page |
![]() (reply draft is not shown, top level comment is collapsed) |
![]() |
How to set up and validate locally
- Check out this branch locally
- Visit an issue or MR
- Start tying a new top-level comment
- Refresh the page
- You will see that your draft remains and the edit state is exposed (this is the behavior already on prod for top-level comment drafts)
- If there are any existing top level comments, start writing a reply to one. Otherwise, submit your comment draft and then start writing a reply to it.
- Refresh the page before submitting your reply comment
- You will see that when you refresh the page, your reply comment draft is visible in the exposed edit state. Autofocus will not move focus to the saved reply draft. The behavior for this threaded reply draft now matches the behavior for top-level comment drafts.
Related to #388684 (closed)
Edited by Chad Lavimoniere