-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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: the value was not cleared correctly when cleaning the range picker #4904
Conversation
|
WalkthroughThe changes in this pull request focus on the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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
packages/@core/ui-kit/form-ui/src/components/form-actions.vueOops! Something went wrong! :( ESLint: 9.14.0 Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/node_modules/@vben/eslint-config/dist/index.mjs' imported from /eslint.config.mjs 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: 1
🧹 Outside diff range and nitpick comments (1)
packages/@core/ui-kit/form-ui/src/components/form-actions.vue (1)
98-102
: Consider adding debug logging for easier troubleshooting.Since this handles a specific edge case in form field clearing, it would be helpful to add debug logging to make troubleshooting easier in production environments.
if (!values[field] && values[startTimeKey] && values[endTimeKey]) { + console.debug( + `Clearing mapped time fields: ${startTimeKey}, ${endTimeKey} for empty field: ${field}` + ); delete values[startTimeKey]; delete values[endTimeKey]; return; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
packages/@core/ui-kit/form-ui/src/components/form-actions.vue
(1 hunks)
🔇 Additional comments (1)
packages/@core/ui-kit/form-ui/src/components/form-actions.vue (1)
94-102
: LGTM! Well-implemented fix for the range picker clearing issue.
The added logic correctly handles the case where the range picker is cleared but mapped time fields still persist. This directly addresses the reported bug in issue #4892 where mapped time fields weren't being properly cleared upon form resubmission.
The implementation is robust because it:
- Properly detects when the range picker has been cleared
- Correctly removes the mapped start/end time values
- Maintains existing behavior for all other cases
* 时间字段为空 但是映射的start/end不为空 说明已经清理了组件的时间(组件右边的x) | ||
* 需要删除对应的start/end字段 否则会被保留 | ||
*/ | ||
if (!values[field] && values[startTimeKey] && values[endTimeKey]) { |
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.
可以试一下 #4906 的方式,我试了下好像可以 |
可以 忽略了undefined的情况导致有问题 我的关了 |
Description
fix: #4892
点击清理按钮后 提交时值没有被正确清理
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
New Features
Bug Fixes
Documentation