Skip to content

Commit

Permalink
[BUGFIX Release] fix memory leak (#86)
Browse files Browse the repository at this point in the history
Ensure prefetch stack and latests variables are per router instance, not per redirect-patch module
  • Loading branch information
stefanpenner authored and nickiaconis committed Aug 11, 2017
1 parent 9a42479 commit 4924be4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addon/initializers/redirect-patch.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import Ember from 'ember';

let hasInitialized = false;
const stack = [];
let latest = null;

export function initialize() {
if (!hasInitialized) {
Expand All @@ -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;
Expand Down

0 comments on commit 4924be4

Please sign in to comment.