DiagramPreview should not rely on setElementVisibility util to always name the css class 'hidden'. We should instead call setElementVisibility to hide the element initially and offer an isElementVisible in the visibility utility instead of using hasClass in the DiagramPreview.
Could we use the Class component to toggle the display of the error and the viewer node in the diagram preview widget instead of writing to the style attribute directly?