Improve Tabs error message for wrapped TabItem components#11676
Improve Tabs error message for wrapped TabItem components#11676Patilpradnesh wants to merge 1 commit intofacebook:mainfrom
Conversation
|
Hi @Patilpradnesh! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Thanks for giving it a try but we don't want to imporve the error message. Instead we want to allow the composition pattern described by the user, see my comment in #11672 (comment) |
|
Thanks for the clarification Sir — that makes sense, and sorry for the confusion on my side. I understand now that the goal is not to improve the error message, but to relax or rework the validation so that wrapper/composition patterns around I’ll re-read your comment in #11672 and take a closer look at how the validation could be adjusted to allow this pattern while still preventing obvious misuse. Happy to iterate on this direction — thanks for the guidance. |
Summary
This PR improves the error message thrown by the
<Tabs>component when a non-<TabItem>child is provided.The goal is to clarify that wrapper or custom components around
<TabItem>are currently not supported by the existing validation logic, which checks the direct React element type.Changes
<Tabs>child validation error message to mention unsupported wrapper/custom components.Context
This change is motivated by the discussion in the linked issue, where users attempted to wrap
<TabItem>in custom components and encountered a confusing error.I intentionally started with an error-message-only change to avoid modifying core behavior without guidance, and I’m very open to iterating on this approach if relaxing the validation is preferred.
Related Issue
Link :- #11672