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): [dropdown] unmounted error #11649

Merged
merged 2 commits into from
Feb 18, 2023
Merged

Conversation

chenxch
Copy link
Member

@chenxch chenxch commented Feb 18, 2023

  1. open dropdown
  2. switch other component
  3. view console

The reason is that when unloading, the used object does not exist.

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.

@github-actions
Copy link

github-actions bot commented Feb 18, 2023

@github-actions github-actions bot added the CommitMessage::Qualified Qualified commit message label Feb 18, 2023
@github-actions
Copy link

github-actions bot commented Feb 18, 2023

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

Copy link
Member

@plainheart plainheart left a comment

Choose a reason for hiding this comment

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

This change only avoids the NPE but cannot fundamentally solve the problem. The value of triggeringElementRef has been cleaned and become undefined when it turns to the onUnmounted hook. Thus I think it's good to use onBeforeUnmount instead.

@chenxch
Copy link
Member Author

chenxch commented Feb 18, 2023

This change only avoids the NPE but cannot fundamentally solve the problem. The value of triggeringElementRef has been cleaned and become undefined when it turns to the onUnmounted hook. Thus I think it's good to use onBeforeUnmount instead.

You're right.

Copy link
Member

@plainheart plainheart left a comment

Choose a reason for hiding this comment

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

LGTM :)

@plainheart plainheart merged commit b15a57a into dev Feb 18, 2023
@plainheart plainheart deleted the fix/dropdown-unmounted branch February 18, 2023 21:13
@element-bot element-bot mentioned this pull request Feb 19, 2023
3 tasks
loosheng pushed a commit to loosheng/element-plus that referenced this pull request Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CommitMessage::Qualified Qualified commit message
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants