Repository navigation
feat: 增加table 帮助信息help通过表单values动态展示内容 - #7712
Conversation
|
📝 WalkthroughWalkthroughThe changes add support for dynamic, context-aware form help text. The Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/@core/ui-kit/form-ui/src/form-render/form-field.vue (1)
178-188: Consider defensive handling forformApiinonHelpFunc.The
formApi!non-null assertion on line 187 assumesformApiis always defined whenonHelpFuncis invoked. However,formApiis derived fromformRenderProps.form(line 63), which could beundefined. Other parts of this file usegetFormApi()which throws a descriptive error whenformApiis missing.For consistency and safer error handling:
♻️ Suggested improvement
const onHelpFunc = () => { if (!help) { return undefined; } - return isFunction(help) ? help(values.value, formApi!) : help; + return isFunction(help) ? help(values.value, getFormApi()) : help; };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/`@core/ui-kit/form-ui/src/form-render/form-field.vue around lines 178 - 188, The onHelpFunc currently uses a non-null assertion on formApi (formApi!) which can be undefined; change onHelpFunc to retrieve formApi safely like other parts of the file (use getFormApi() or explicitly check formApi before using it) so it throws the same descriptive error when missing; update references in computedHelp/onHelpFunc to call getFormApi() or guard against undefined before calling help(values.value, formApi) so behavior and error messaging are consistent with the rest of the file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/`@core/ui-kit/form-ui/src/form-render/form-field.vue:
- Around line 178-188: The onHelpFunc currently uses a non-null assertion on
formApi (formApi!) which can be undefined; change onHelpFunc to retrieve formApi
safely like other parts of the file (use getFormApi() or explicitly check
formApi before using it) so it throws the same descriptive error when missing;
update references in computedHelp/onHelpFunc to call getFormApi() or guard
against undefined before calling help(values.value, formApi) so behavior and
error messaging are consistent with the rest of the file.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 09fbea0a-e379-4a6a-ae0f-e1b96a68a5e4
📒 Files selected for processing (3)
packages/@core/ui-kit/form-ui/src/form-render/form-field.vuepackages/@core/ui-kit/form-ui/src/types.tsplayground/src/views/examples/form/basic.vue
table 帮助信息help支持通过表单values动态展示内容
Summary by CodeRabbit
Release Notes
New Features
Documentation