Skip to content

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

Closed
@baco16g

Description

@baco16g

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions