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

feat(TabPanels): Add validation for React elements #2117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

synuns
Copy link

@synuns synuns commented May 10, 2024

Overview

This PR introduces a check to ensure that each child processed in the TabPanels component is a valid React element. This update is crucial for preventing runtime errors that occur when non-element children (such as strings or booleans) are included in the Tabs component.

Changes

  • Added a validation using React.isValidElement before processing children in TabPanels.
  • This ensures that only valid React elements are cloned and manipulated, which enhances the robustness of the component.

Impact

  • Prevents potential bugs and crashes in applications using the TabPanels component with diverse children types.
  • Improves the reliability and developer experience by ensuring that only appropriate children are processed.

@synuns synuns requested a review from a team as a code owner May 10, 2024 14:38
Copy link
Contributor

@YossiSaadi YossiSaadi left a comment

Choose a reason for hiding this comment

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

Hey @synuns!
Thank you for your addition to Vibe!

I'm curious, though, could you share what caused you to add this check?
We aim to understand the various use cases and experiences of our community, and your insight could be valuable.
Is it something that couldn't be caught during development?

@YossiSaadi YossiSaadi changed the title enhance(TabPanels): Add validation for React elements feat(TabPanels): Add validation for React elements May 16, 2024
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.

None yet

3 participants