Refactor(material): Replace Hidden component by LukasBoll · Pull Request #2315 · eclipsesource/jsonforms
Hi @LukasBoll , thank you for the contribution ❤️
Many of the refactoring already look good to me :) However, I discovered that you introduced new <div> elements at some places for the removed <Hidden> elements.
Is this really necessary? I think they are superfluous. If you just need a wrapper component to return multiple sibling elements, the React Fragment <>...</> can be used instead. This won't create an additional DOM element.
The files with introduced div I saw are:
- packages/material-renderers/src/additional/MaterialListWithDetailRenderer.tsx
- packages/material-renderers/src/complex/MaterialAllOfRenderer.tsx
- packages/material-renderers/src/complex/MaterialAnyOfRenderer.tsx
- packages/material-renderers/src/complex/MaterialArrayControlRenderer.tsx
- packages/material-renderers/src/complex/MaterialOneOfRenderer.tsx
- packages/material-renderers/src/controls/MaterialBooleanControl.tsx
- packages/material-renderers/src/controls/MaterialBooleanToggleControl.tsx
- packages/material-renderers/src/layouts/MaterialCategorizationLayout.tsx
- packages/material-renderers/src/layouts/MaterialCategorizationStepperLayout.tsx
- packages/material-renderers/src/mui-controls/MuiAutocomplete.tsx
For the MaterialAnyOfRenderer and the MaterialArrayControlRenderer I checked whether the removed <Hidden> resulted in a missing <div>. This turned out to be false. Instead the newly added <div> added in this PR was there on top. This suggests that the <div> is not necessary.
Please check whether wrapping in a <div> is really necessary for the aforementioned renderers. If not, use the react fragment <> instead to return multiple sibling elements.