-
Notifications
You must be signed in to change notification settings - Fork 333
fix(grid): fix insert rowIndex error #3916
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: dev
Are you sure you want to change the base?
Conversation
WalkthroughCache management updates were implemented across two methods files. The edit methods now invoke updateCache after insert and remove operations to maintain consistency. Additionally, updateCache's data source was switched from rawData to tableFullData to ensure cache reflects the correct data state. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10–15 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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.
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/vue/src/grid/src/table/src/methods.ts (1)
410-480: Consider performance optimization for bulk operations.The current implementation rebuilds the entire cache on every
updateCache()call. For typical single insert/remove operations this is fine, but if your grid supports bulk operations (inserting/removing many rows at once), you might want to consider:
- Batching: Only call
updateCache()once after bulk operations complete- Incremental updates: Update only affected row indexes instead of rebuilding the entire cache
The current implementation is correct and maintainable. This optimization would only be necessary if profiling shows performance issues with bulk operations.
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/vue/src/grid/src/edit/src/methods.ts(2 hunks)packages/vue/src/grid/src/table/src/methods.ts(1 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: PR E2E Test (pnpm test:e2e3)
- GitHub Check: verify-main-build
🔇 Additional comments (3)
packages/vue/src/grid/src/edit/src/methods.ts (2)
142-142: Correctly updates cache after inserting records.This ensures
fullDataRowIdDataandfullDataRowMapare rebuilt to include the newly inserted rows with correct indexes, fixing the rowIndex error described in the PR.
216-216: Correctly updates cache after removing records.This maintains cache consistency by recalculating row indexes for all remaining rows after removal, ensuring symmetry with the insert operation.
packages/vue/src/grid/src/table/src/methods.ts (1)
411-412: Critical fix: Cache now reflects current data state including insertions.Changing the data source from
rawDatatotableFullDatais essential for this fix:
rawData: Original data source (doesn't include inserted rows)tableFullData: Current table data (includes inserted rows)This ensures that when
updateCache()is called after insert operations, the cache includes the newly inserted rows with correct indexes.
PR
修复插入的数据rowIndex不正确问题
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
Release Notes
Bug Fixes
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.