Restore diff file draft note editing state

What does this MR do and why?

This merge request resolves Text of unsaved comment on file of merge reques... (#436954 - closed).

In this MR we ensure that a diff file draft editing form is properly restored when we scroll through the diff files of a merge request.

Because virtual scroller destroys the instances of components that are not visible we will lose the draft note editing state if we scroll the page far enough. To fix that we'll store the editing state on the note itself and will autosave feature to restore the edited note text.

Screenshots or screen recordings

Before After
Screen_Recording_2024-12-26_at_18.31.02 Screen_Recording_2024-12-26_at_18.28.04

How to set up and validate locally

  1. Visit any merge request with many files (at least 20)
  2. Open the changes tab and add a draft comment on the first file
  3. Edit that comment, change the note text
  4. Scroll to the bottom of the page
  5. Scroll back to the first file
  6. Editing form should be opened and the content should match your edit

Merge request reports

Loading