Skip to content
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(components): [tree] node drag error when using custom allowDrop method #15005

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

CherishTheYouth
Copy link
Contributor

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

Description

When the allowDrop function transfer from true to false, dragState.value.dropNode have not been reset, that casuse exception when treeNodeDragEnd() is triggered.

Related Issue

Fixes #14704.

Explanation of Changes

I set dragState.value.dropNode to null when dropPrev || dropInner || dropNext is false, and it will not execute the following codes in treeNodeDragEnd:

if (draggingNode && dropNode) {
....
}

- Reset dragState.value.dropNode to null when allowDrop is transfered from true to false.(For issue element-plus#14704)
Copy link

👋 @CherishTheYouth, seems like this is your first time contribution to element-plus.

  • Please make sure that you have read our guidelines and code of conduct before making a contribution.
  • You can comment with /label Components:[component_name] to add a label for which component you are working on.
  • You may join our Discord for staying tuned.

@pull-request-triage pull-request-triage bot added 1st contribution Their very first contribution Needs Review labels Nov 29, 2023
Copy link

github-actions bot commented Nov 29, 2023

Copy link

Hello @CherishTheYouth, thank you for contributing to element-plus, please see our guideline to see how to make contribution

Copy link

github-actions bot commented Dec 2, 2023

🧪 Playground Preview: https://element-plus.run/?pr=15005
Please comment the example via this playground if needed.

@btea btea changed the title fix(components): [tree] fix issue #14704 fix(components): [tree] node drag error when using custom allowDrop method Dec 2, 2023
Copy link
Member

@FrontEndDog FrontEndDog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

@FrontEndDog FrontEndDog merged commit d408533 into element-plus:dev Dec 16, 2023
12 checks passed
@CherishTheYouth
Copy link
Contributor Author

Thank you for your contribution!

Grateful for making time CR.

@CherishTheYouth CherishTheYouth deleted the fix/#14704 branch December 19, 2023 04:34
@element-bot element-bot mentioned this pull request Jan 10, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Component] [tree] el-tree 拖动
3 participants