-
Notifications
You must be signed in to change notification settings - Fork 403
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
fix: immediately update with current component to handle initial badge #4238
fix: immediately update with current component to handle initial badge #4238
Conversation
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
warning eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options. 变更概述演练此次变更主要针对 变更
建议标签
建议审阅者
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/main-layout/src/browser/tabbar/bar.view.tsx (1)
252-258
: 建议保持与 IconTabView 的实现一致当前实现虽然能够解决徽章更新的问题,但建议与 IconTabView 保持一致的实现方式,提高代码的可维护性。
建议修改如下:
useEffect(() => { + // Immediately update with current component to handle initial badge value + setComponent({ ...component }); + const dispose = component.onChange((newComponent) => { - // Immediately update with current component to handle initial badge value setComponent({ ...newComponent }); }); return () => { dispose.dispose(); }; }, [component]);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/main-layout/src/browser/tabbar/bar.view.tsx
(2 hunks)
🔇 Additional comments (1)
packages/main-layout/src/browser/tabbar/bar.view.tsx (1)
217-226
: 优化了徽章图标的初始状态更新逻辑
通过立即更新组件状态并添加正确的依赖项,确保了徽章图标能够在初始化时正确显示。这个改动解决了徽章不能及时更新的问题。
…t-to-handle-initial-badge-value
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v3.6 #4238 +/- ##
=======================================
Coverage 54.06% 54.06%
=======================================
Files 1616 1616
Lines 97967 97967
Branches 20056 20048 -8
=======================================
+ Hits 52964 52969 +5
+ Misses 37393 37390 -3
+ Partials 7610 7608 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
immediately update with current component to handle initial badge value
Types
Background or solution
Fix the issue where the badge icon of the tab bar does not update when a change file appears.
Changelog
Summary by CodeRabbit
新功能
修复