Repository navigation
fix: 修正vxtable不存在formConfig时,直接变更data失效问题 - #7906
Conversation
修正vxtable不存在formConfig时,直接变更data失效问题
|
📝 WalkthroughWalkthroughLines 233–235 in ChangesVxeTable Grid Options Alignment
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/effects/plugins/src/vxe-table/use-vxe-grid.vue`:
- Around line 234-235: The guard using `tableData.value.length > 0` prevents
assigning an empty array and leaves stale rows; change the condition to detect
arrays (e.g. use `Array.isArray(tableData.value)`) and always set
`mergedOptions.data = tableData.value` when it is an array (including empty) so
clears propagate; update the assignment logic around `tableData` /
`mergedOptions.data` in use-vxe-grid accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b638c81c-4668-4d1d-be46-0760f4ab6042
📒 Files selected for processing (1)
packages/effects/plugins/src/vxe-table/use-vxe-grid.vue
| if (tableData.value && tableData.value.length > 0) { | ||
| mergedOptions.data = tableData.value; |
There was a problem hiding this comment.
Empty-array updates are still dropped, which can leave stale table rows.
On Line 234, the length > 0 guard prevents propagating tableData = [], so clearing data may not take effect and previous rows can remain visible. Assign whenever tableData.value is an array (including empty).
💡 Suggested fix
- if (tableData.value && tableData.value.length > 0) {
- mergedOptions.data = tableData.value;
- }
+ if (Array.isArray(tableData.value)) {
+ mergedOptions.data = tableData.value;
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (tableData.value && tableData.value.length > 0) { | |
| mergedOptions.data = tableData.value; | |
| if (Array.isArray(tableData.value)) { | |
| mergedOptions.data = tableData.value; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/effects/plugins/src/vxe-table/use-vxe-grid.vue` around lines 234 -
235, The guard using `tableData.value.length > 0` prevents assigning an empty
array and leaves stale rows; change the condition to detect arrays (e.g. use
`Array.isArray(tableData.value)`) and always set `mergedOptions.data =
tableData.value` when it is an array (including empty) so clears propagate;
update the assignment logic around `tableData` / `mergedOptions.data` in
use-vxe-grid accordingly.
修正vxtable不存在formConfig时,直接变更data失效问题
Summary by CodeRabbit
Note: This release contains no functional changes or user-visible updates.