Steps to reproduce:
- Create a template with more than 1 parameter. Name one of the parameters literally undefined.
- Add basic TemplateData info to the template. Can be the auto-generated stuff.
- Start VisualEditor. Add the template.
- Add the undefined parameter.
- Try to add another parameter. The undefined parameter disappears.
The reason for this behavior is that the placeholder is accidentally named <template name>/undefined, and there is no way to distinguish this from a parameter that's literally named like this. The bug probably exists since 2014, see https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/116902.
The patch changes the ID to <template name>/, which is unique. There is only 1 placeholder at a time. I manually confirmed that this 1-line patch indeed fixes the issue.