Skip to content

fix: fix error when children include invalid element#286

Open
AshoneA wants to merge 1 commit into
react-component:2.xfrom
AshoneA:bugfix/treenode
Open

fix: fix error when children include invalid element#286
AshoneA wants to merge 1 commit into
react-component:2.xfrom
AshoneA:bugfix/treenode

Conversation

@AshoneA

@AshoneA AshoneA commented Dec 30, 2019

Copy link
Copy Markdown

fix error when first-level children include invalid element

@vercel

vercel Bot commented Dec 30, 2019

Copy link
Copy Markdown

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

Comment thread src/Tree.tsx
*/
renderTreeNode = (child, index, level = 0) => {
if (!React.isValidElement(child)) {
return null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should be return child?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If an element is invalid, I think there's no difference between child and null. return child should be also fine.

@codecov

codecov Bot commented May 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.98%. Comparing base (4b3d17c) to head (f91a763).
⚠️ Report is 3 commits behind head on 2.x.

Additional details and impacted files
@@           Coverage Diff           @@
##              2.x     #286   +/-   ##
=======================================
  Coverage   98.98%   98.98%           
=======================================
  Files           5        5           
  Lines         689      691    +2     
  Branches      209      210    +1     
=======================================
+ Hits          682      684    +2     
  Misses          7        7           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants