-
Notifications
You must be signed in to change notification settings - Fork 298
fix(tabs): 兼容16的处理 #3150
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
Merged
Merged
fix(tabs): 兼容16的处理 #3150
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
455ac0b
fix: popover 无法消失
xiaoyatong 1d753f8
Merge branch 'feat_v3.x' of github.com:jdf2e/nutui-react into feat_v3.x
xiaoyatong 6944c3a
Merge branch 'feat_v3.x' of github.com:jdf2e/nutui-react into feat_v3.x
xiaoyatong f582ce6
Merge branch 'feat_v3.x' of github.com:jdf2e/nutui-react into feat_v3.x
xiaoyatong 8c80de5
Merge branch 'feat_v3.x' of github.com:jdf2e/nutui-react into feat_v3.x
xiaoyatong 670f567
Merge branch 'feat_v3.x' of github.com:jdf2e/nutui-react into feat_v3.x
xiaoyatong a5eded7
Merge branch 'feat_v3.x' of github.com:jdf2e/nutui-react into feat_v3.x
xiaoyatong 17d9c3e
fix: merge
xiaoyatong 98d9852
Merge branch 'feat_v3.x' of github.com:jdf2e/nutui-react into feat_v3.x
xiaoyatong 265378d
fix(tabs): 兼容react 16
xiaoyatong 667d53a
test: fixed
xiaoyatong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
❓ Verification inconclusive
代码修改提高了逻辑清晰度,并解决了 React 16 兼容性问题
将逻辑与(&&)运算符替换为三元运算符是一个很好的改进。这种修改明确了当
children不存在时返回null,而不是可能导致的隐式undefined。这解决了在 React 16 中可能出现的渲染问题,使组件行为更加可预测。不过,根据静态分析工具的提示,第 35 行(返回 null 的情况)没有被测试覆盖。建议添加相应的测试用例,确保这种边缘情况得到正确处理。
🏁 Script executed:
Length of output: 165
重点:请添加针对 children 为空情况的测试用例
代码修改提升了逻辑清晰度,并解决了 React 16 兼容性问题。将逻辑与(&&)运算符替换为三元运算符,使组件在 children 为空时明确返回 null,避免了可能的隐式 undefined 问题。
不过,目前在项目中没有找到可验证 children 为空(返回 null)的测试用例,可能会导致这一边缘情况在未来未被覆盖。建议补充相应的测试用例,以确保此情况得到正确处理。
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 35-35: src/packages/tabpane/tabpane.tsx#L35
Added line #L35 was not covered by tests