Description template for new issues overwrite local storage with unsaved data
Summary
Any unsubmitted input in the description field of a new issue is overwritten by the default issue template when you accidentally refresh / or close the page. Whereas any unsaved description input in an issue is saved in the local storage when you don't use issue description templates. And the title of the issue is properly taken from the buffer like expected.
Steps to reproduce
- Start writing a new issue:
https://gitlab.com/gitlab-org/gitlab/-/issues/new
- Write some text in the Description field
- Press 'go back' in your browser (this happens accidentally sometimes when my finger touches the trackpad of my mac incorrectly)
- Press 'go forward' in your browser
Example Project
You can reproduce this behaviour on the page that you are currently visiting.
What is the current bug behaviour?
When visiting https://gitlab.com/gitlab-org/gitlab/-/issues/new
after it was closed, we do shortly see a snapshot o the old input. But within a split second this gets overwritten with the default issue template.
What is the expected correct behaviour?
In case the issue description would have been populated with text, I would expect this text was taken from the local storage, as is the case when you don't use description templates.
Output of checks
This bug happens on GitLab.com
Possible fixes
It is expected that the unsaved input is correctly saved from the local storage buffer, but that it gets overwritten with the default template afterwards. So it is expected that it should be fixed in the part of the code where the default template is loaded and initialized on the page as the issue description input. I can't find the exact line where this goes wrong.