Comment text clearing on failed save

Summary

I'm getting properly-handled 422 errors back from the API (#331305 (closed)) when I try to save a comment on an open merge request. Unfortunately, the frontend seems to not be preserving the text of my comment on the error, so I'm forced to retype the whole thing again to try to send it again. We normally preserve text in forms across navigation etc. to prevent such loss of draft writing.

Steps to reproduce

  1. Open gitlab-com/www-gitlab-com!81207 (diffs)
  2. Try to save a comment with a suggestion in it to line 3 of data/release_posts/13_12/browser-performance-job-rename-release-update.yml that currently fails.

Example Project

  • gitlab-com/www-gitlab-com, MR linked above.

What is the current bug behavior?

The comment box is cleared and my writing is gone when the "Failed to save" error message appears.

What is the expected correct behavior?

My comment should be persisted, so I can try to fix my input or at least save the text somewhere outside of the browser to preserve my writing while I figure out the problem.

Relevant logs and/or screenshots

lost_comment

image

Output of checks

This bug happens on GitLab.com

Possible fixes

Edited by drew stachon