Open graybeal opened 3 years ago
Marcos suspected a link to an element, "Type of service", that contained within it an empty element also called "Type of service."
I convinced myself that the fix to the "quick-close" fields is to delete the blank type of service element in the parent Type of Service element. Any template that has that empty element can't generate a healthy metadata editor. As soon as I get rid of it in a template and clear the cache on the new instance, it works fine.
I can guess how that probably got created, too. The template author works in multiple windows, and if she created the Type of Service element and saved right away (so it was empty at that point), then re-created another Type of Service and incorporated the first one, the included element would have been empty. Later she would have deleted the empty element from her workspace when she realized she had two.
I created a diffchecker at https://www.diffchecker.com/O7FdhHA6 showing the original and the modified element. It's kinda weird what was changed when I deleted the empty element. And what's also weird is I can't change the original bad element, only a copy of it.
So I went ahead and renamed the original element to add ' BAD' to its name, and made a new 'Type of service' element in its place that has the empty element deleted.
I've been looking into this issue in detail, and the workflow that you described, although it's uncommon, doesn't make the UI fail. The main problem with that element is that both 'Type of service' elements have the same identifier, and our UI cannot deal with an element nested into the same element. The result is an infinite loop. ($rootScope:infdig error in JS - see the screenshot below). In the steps you described, the two elements would have different identifiers, which is fine even if the nested one is empty.
So we know how to fix this if it occurs, but we just need to know how to make it happen so we can avoid that? Just including an element in itself won't do it, I presume.
Here are the steps to reproduce it:
We found we couldn't create metadata in a VODAN Project Content template, the fields immediately closed.
Complicating things, after trying to generate metadata with the afflicted template, the same behavior happened on any other template until the cache was cleared.