-
-
Notifications
You must be signed in to change notification settings - Fork 462
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(thought-chain): 非受控模式无法工作 #627
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthrough本次 PR 增加了一个新的测试用例,用于验证 ThoughtChain 组件在非受控模式下的点击操作是否能正确展开。同时,对组件的状态管理逻辑进行了修改,在 Changes
Sequence Diagram(s)sequenceDiagram
participant T as 测试用例
participant A as App 组件
participant TC as ThoughtChain 组件
participant HC as useCollapsible Hook
T->>A: 渲染包含非受控模式的 ThoughtChain组件
A->>TC: 初始化组件
TC->>HC: 检查 collapsible 参数
alt collapsible 为 true
HC->>HC: 调用 useMergedState(undefined)
else
HC->>HC: 调用 useMergedState({defaultValue, value, onChange})
end
T->>TC: 模拟 header 点击事件
TC-->>T: 展开并显示 body 元素
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code Definitions (1)components/thought-chain/__tests__/index.test.tsx (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
🔇 Additional comments (2)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 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 (
|
变更概述此 PR 修复了在 变更详情
🪧 TipsFor further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me. |
@@ -53,12 +53,19 @@ const useCollapsible: UseCollapsible = (collapsible, prefixCls, rootPrefixCls) = | |||
}, [collapsible]); | |||
|
|||
// ============================ ExpandedKeys ============================ | |||
const collapsibleIsTrue = collapsible === true; |
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.
确保 collapsible
的值为 true
时,useMergedState
的配置为 undefined
,以便在非受控模式下正确初始化状态。
Bundle ReportChanges will increase total bundle size by 32 bytes (0.02%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: antdx-array-pushAssets Changed:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #627 +/- ##
==========================================
+ Coverage 91.88% 91.90% +0.02%
==========================================
Files 67 67
Lines 1466 1470 +4
Branches 372 375 +3
==========================================
+ Hits 1347 1351 +4
Misses 119 119 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
English Template / 英文模板
🤔 这个变动的性质是?
🔗 相关 Issue
fix #598
💡 需求背景和解决方案
由于 #598 的改动会产生一个新的问题,当
collapsible
为true
时,点击面板无法正常展开📝 更新日志
Summary by CodeRabbit