From 4924be4a71fc77e2ce2dc81465b8d537352b4160 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Fri, 11 Aug 2017 10:01:01 -0700 Subject: [PATCH] [BUGFIX Release] fix memory leak (#86) Ensure prefetch stack and latests variables are per router instance, not per redirect-patch module --- addon/initializers/redirect-patch.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addon/initializers/redirect-patch.js b/addon/initializers/redirect-patch.js index 8a2dfdc..7ddeed7 100644 --- a/addon/initializers/redirect-patch.js +++ b/addon/initializers/redirect-patch.js @@ -1,8 +1,6 @@ import Ember from 'ember'; let hasInitialized = false; -const stack = []; -let latest = null; export function initialize() { if (!hasInitialized) { @@ -17,6 +15,8 @@ export function initialize() { // https://emberjs.com/deprecations/v2.x/#toc_ember-router-router-renamed-to-ember-router-_routermicrolib const router = this._routerMicrolib || this.router; const emberRouter = this; + const stack = []; + let latest = null; // replace router's transitionByIntent method, through which all transitions pass const oldTransitionByIntent = router.transitionByIntent;