This fixes a bug where the file templates would not be cleared
after changing the template type.
Previously the templates would get pushed into the array
creating a list of templates for the different types.
This changes that by clearing the templates array
when the template type gets changed.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/52487