-
Notifications
You must be signed in to change notification settings - Fork 264
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(transfer): [transfer] fix drag 2 item to right when set filterable=true #2492
base: release-3.18.0
Are you sure you want to change the base?
fix(transfer): [transfer] fix drag 2 item to right when set filterable=true #2492
Conversation
WalkthroughThe pull request introduces modifications to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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/renderless/src/transfer/index.ts (1)
232-233
: Add array bounds check and approve filtered data usage.The change to use
filteredData
from panel refs correctly fixes the drag functionality whenfilterable=true
. However, add bounds checking to prevent undefined access:- ? rightPanel.state.filteredData[event.oldIndex][props.props.key] - : leftPanel.state.filteredData[event.oldIndex][props.props.key] + ? (rightPanel.state.filteredData[event.oldIndex] || {})[props.props.key] + : (leftPanel.state.filteredData[event.oldIndex] || {})[props.props.key]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
packages/renderless/src/transfer/index.ts
(1 hunks)packages/renderless/src/transfer/vue.ts
(2 hunks)
🔇 Additional comments (4)
packages/renderless/src/transfer/vue.ts (2)
64-64
: LGTM: Clean parameter addition
The addition of the vm
parameter to the function signature is well-structured and maintains proper TypeScript typing through the ITransferRenderlessParamUtils
interface.
83-83
: Verify panel references access
The update to include vm
in the logicFun
call looks correct. However, let's verify that the panel references are properly accessed in the implementation.
✅ Verification successful
Panel references are correctly accessed through vm parameter
The implementation shows proper usage of panel references through vm.$refs
:
vm.$refs.rightPanel
andvm.$refs.leftPanel
are correctly accessed to get panel data- These refs are used to access the filtered data and handle item transfers between panels
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the implementation of logicFun and its usage of panel references
# Expected: Find the implementation showing proper usage of vm parameter to access panel refs
# Search for logicFun implementation
ast-grep --pattern 'export const logicFun = $_'
# Backup: Search using ripgrep if ast-grep doesn't find it
rg -A 10 'export const logicFun'
Length of output: 3965
packages/renderless/src/transfer/index.ts (2)
220-233
: Verify edge cases with manual testing.
While the changes correctly fix the drag functionality when filterable=true
, please ensure the following scenarios are tested:
- Dragging when filter returns no results
- Dragging when filter returns single item
- Dragging with filter applied to both panels
Let's check if there are any existing tests we should update:
220-220
: Add type annotation for the vm
parameter.
The vm
parameter lacks proper TypeScript type annotation. This should be properly typed to maintain type safety.
Let's verify all callers of this function to ensure they're updated:
const rightPanel = vm.$refs.rightPanel | ||
const leftPanel = vm.$refs.leftPanel | ||
|
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.
Add null checks for panel refs.
The code assumes that panel refs will always be available. Add null checks to prevent runtime errors:
- const rightPanel = vm.$refs.rightPanel
- const leftPanel = vm.$refs.leftPanel
+ const rightPanel = vm.$refs.rightPanel
+ const leftPanel = vm.$refs.leftPanel
+
+ if (!rightPanel?.state?.filteredData || !leftPanel?.state?.filteredData) {
+ console.warn('Transfer panel refs or filtered data not available')
+ return
+ }
📝 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.
const rightPanel = vm.$refs.rightPanel | |
const leftPanel = vm.$refs.leftPanel | |
const rightPanel = vm.$refs.rightPanel | |
const leftPanel = vm.$refs.leftPanel | |
if (!rightPanel?.state?.filteredData || !leftPanel?.state?.filteredData) { | |
console.warn('Transfer panel refs or filtered data not available') | |
return | |
} |
PR
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
New Features
Bug Fixes