Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor(material): Replace Hidden component #2315

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

LukasBoll
Copy link
Contributor

Removes the deprecated hidden component and instead returns null if the hidden property is set.

Closes #2107

Copy link

netlify bot commented Apr 8, 2024

Deploy Preview for jsonforms-examples ready!

Name Link
🔨 Latest commit e3a8a9f
🔍 Latest deploy log https://app.netlify.com/sites/jsonforms-examples/deploys/661cfd1540bfc100090bbe2c
😎 Deploy Preview https://deploy-preview-2315--jsonforms-examples.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@coveralls
Copy link

coveralls commented Apr 8, 2024

Coverage Status

coverage: 84.383% (-0.007%) from 84.39%
when pulling e3a8a9f on LukasBoll:remove_hidden
into b87f5b8 on eclipsesource:master.

@lucas-koehler lucas-koehler self-requested a review April 9, 2024 08:08
Copy link
Contributor

@lucas-koehler lucas-koehler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Removes the deprecated hidden component and instead returns null if the hidden property is set.

Closes eclipsesource#2107
@LukasBoll
Copy link
Contributor Author

Hi @lucas-koehler ,
thanks for the review. Indeed I just wanted to wrap multiple elements. Thanks for the Fragment hint! I updated and tested the corresponding renderers the solution with the Fragment worked fine!

Copy link
Contributor

@lucas-koehler lucas-koehler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now. Thanks for the updates!

@lucas-koehler lucas-koehler merged commit 0ee8bf2 into eclipsesource:master Apr 15, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove use of Hidden from materialRenderers
3 participants