-
Notifications
You must be signed in to change notification settings - Fork 8k
fix: 解决搜索表单中arrayToStringFields属性无法在搜索时生效的问题 #6591
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
base: main
Are you sure you want to change the base?
Conversation
- 合并handleArrayToStringFields与handleStringToArrayFields为handleMultiFields - 在handleMultiFields判断arrayToString或stringToArray - 删除两个方法在其他地方的引用 统一为在handleRangeTimeValue内调用handleMultiFields实现数据转换
|
WalkthroughThis change consolidates the logic for converting between string and array form fields into a single, enhanced Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant FormApi
participant FormValues
User->>FormApi: setValues(values)
FormApi->>FormApi: handleMultiFields(values)
alt Value is array
FormApi->>FormValues: Join array to string using separator
else Value is string
FormApi->>FormValues: Split string to array using separator
end
FormApi->>User: Updated form values
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
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:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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/@core/ui-kit/form-ui/src/form-api.ts (1)
459-513
: Well-implemented bidirectional field conversion!The consolidation of array/string conversion logic into a single method is clean and handles edge cases properly:
- Correct regex escaping for special separator characters
- Proper empty string handling
- Support for both configuration formats
Consider adding JSDoc comments to document the expected behavior and configuration formats for better maintainability.
Add documentation above the method:
+ /** + * Handles bidirectional conversion between array and string field values + * @param originValues - The form values to process + * @example + * // Simple format: ['field1', 'field2', ';'] + * // Nested format: [['field1', 'field2'], ';'] + */ private handleMultiFields = (originValues: Record<string, any>) => {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/@core/ui-kit/form-ui/src/form-api.ts
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: post-update (windows-latest)
- GitHub Check: post-update (ubuntu-latest)
🔇 Additional comments (1)
packages/@core/ui-kit/form-ui/src/form-api.ts (1)
515-523
: Correct integration of field conversion in the processing pipeline.The
handleMultiFields
call is properly placed to ensure array/string conversions occur before time range processing, maintaining the correct data transformation order.
给我一个测试样例 我测试一下功能 |
Description
Type of change
Please delete options that are not relevant.
pnpm-lock.yaml
unless you introduce a new test example.Checklist
pnpm run docs:dev
command.pnpm test
.feat:
,fix:
,perf:
,docs:
, orchore:
.Summary by CodeRabbit