From a32f41c8901d06fd3aba2603ba782bb10f1006e4 Mon Sep 17 00:00:00 2001 From: Sergey Astapov Date: Wed, 24 Mar 2021 23:21:04 -0400 Subject: [PATCH] Run service teardown code in willDestroy() --- addon/services/router-scroll.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addon/services/router-scroll.js b/addon/services/router-scroll.js index 1dae325..29d672f 100644 --- a/addon/services/router-scroll.js +++ b/addon/services/router-scroll.js @@ -91,9 +91,7 @@ class RouterScroll extends Service { addListener(this.router, 'routeDidChange', this._routeDidChange); } - destroy() { - reset(); - + willDestroy() { removeListener(this.router, 'routeWillChange', this._routeWillChange); removeListener(this.router, 'routeDidChange', this._routeDidChange); @@ -105,7 +103,7 @@ class RouterScroll extends Service { window.cancelAnimationFrame(callbackRequestId); } - super.destroy(...arguments); + super.willDestroy(...arguments); } /**