Skip to content

Component doesn't clean up after itself #19

Closed
@adambullmer

Description

@adambullmer

Expected Behavior

If I am on a page with the parallax component on it, navigate to a new page in the app, I expect the scroll event listener to no longer fire.

Actual Behavior

When I visit a page with the parallax element, and then navigate to another page without it, when I scroll, I get bombarded with console errors. I source dived a little and found that there isn't a defined cleanup for this component, like turning off the scroll event listener.

vue-parallaxy.min.js?ab81:1 Uncaught TypeError: Cannot read property 'getBoundingClientRect' of undefined
    at VueComponent.isInView (vue-parallaxy.min.js?ab81:1)
    at VueComponent.boundFn [as isInView] (vue.esm.js?65d7:182)
    at eval (vue-parallaxy.min.js?ab81:1)
isInView @ vue-parallaxy.min.js?ab81:1
boundFn @ vue.esm.js?65d7:182
(anonymous) @ vue-parallaxy.min.js?ab81:1
requestAnimationFrame (async)
scrollHandler @ vue-parallaxy.min.js?ab81:1
boundFn @ vue.esm.js?65d7:182

Environment

  • OS: Mac OSX 10.13.1
  • NPM version: Yarn 1.2.0
  • vue.js version: 2.4.2
  • vue-parallax version: 1.0.3

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions