Skip to content

Please remove the scroll event applied to the document in the beforeDestroy hook. #205

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

Closed
baco16g opened this issue May 7, 2020 · 2 comments
Labels

Comments

@baco16g
Copy link

baco16g commented May 7, 2020

Describe

  • In page mode, scroll event is added to document.
  • But when the VirtualList is Unmounted, its event handler is not removed.

// in page mode we bind scroll event to document
if (this.pageMode) {
document.addEventListener('scroll', this.onScroll, {
passive: false
})

beforeDestroy () {
this.virtual.destroy()
},

To Reproduce

Steps to reproduce the behavior:

  1. Prepare a Switcher to display / hide the VirtualList.
  2. Scroll when VirtualList is hidden.
  3. See TypeError

Reproduce demo

https://codesandbox.io/s/live-demo-virtual-list-28trm

Other

  • Version: 2.1.9
  • Browser: Chrome, Safari
@baco16g baco16g added the bug label May 7, 2020
@baco16g baco16g changed the title Please remove the scroll event applied to the document with the beforeDestroy hook. Please remove the scroll event applied to the document in the beforeDestroy hook. May 7, 2020
@tangbc
Copy link
Owner

tangbc commented May 7, 2020

OK, I will fix it soon.

tangbc added a commit that referenced this issue May 7, 2020
@tangbc
Copy link
Owner

tangbc commented May 7, 2020

Fixed and published in v2.2.0

@tangbc tangbc closed this as completed May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants