Description
When live components try to apply changes to elements for some reason the different classes are picked up with whitespaces or even empty strings. Browser console then throws Uncaught (in promise) DOMException: DOMTokenList.remove: The empty string is not a valid token.
.
This happened here when an element was morphed that probably shouldn't have been in the first place (and data-skip-morph
doesn't solve the problem).
For example when an inline menu (with ID and data-skip-morph
) is displayed after clicking an element only the class "hidden" changes. Then after updating the live component the element and its menu are still there (but the menu should be invisible, as backend renders context menus hidden of course):
The changes that are picked up:
addedClasses: Set [ "w-full" ]
.removedClasses: Set(3) [ "", "hidden\n", "w-full\n" ]
In my case, simply filtering class changes at least prevents the error and didn't have any side effects here:
className = className.trim();
if (className === '') {
return;
}
ux/src/LiveComponent/assets/src/Rendering/ElementChanges.ts
Lines 13 to 23 in 80b36bc
Am I doing something wrong?