Skip to content

Commit 1fdc15c

Browse files
Revert memory leak change from 0.11.0
Caused many issues, though in principle the idea seems sound. Needs further investigation and a more robust implementation.
1 parent 101d260 commit 1fdc15c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/directives/pagination/dirPagination.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,12 @@
6868
// Now that we have access to the `scope` we can interpolate any expression given in the paginationId attribute and
6969
// potentially register a new ID if it evaluates to a different value than the rawId.
7070
var paginationId = $parse(attrs.paginationId)(scope) || attrs.paginationId || DEFAULT_ID;
71+
72+
// (TODO: this seems sound, but I'm reverting as many bug reports followed it's introduction in 0.11.0.
73+
// Needs more investigation.)
7174
// In case rawId != paginationId we deregister using rawId for the sake of general cleanliness
7275
// before registering using paginationId
73-
paginationService.deregisterInstance(rawId);
76+
// paginationService.deregisterInstance(rawId);
7477
paginationService.registerInstance(paginationId);
7578

7679
var repeatExpression = getRepeatExpression(expression, paginationId);
@@ -105,12 +108,14 @@
105108

106109
// Delegate to the link function returned by the new compilation of the ng-repeat
107110
compiled(scope);
108-
111+
112+
// (TODO: Reverting this due to many bug reports in v 0.11.0. Needs investigation as the
113+
// principle is sound)
109114
// When the scope is destroyed, we make sure to remove the reference to it in paginationService
110115
// so that it can be properly garbage collected
111-
scope.$on('$destroy', function destroyDirPagination() {
112-
paginationService.deregisterInstance(paginationId);
113-
});
116+
// scope.$on('$destroy', function destroyDirPagination() {
117+
// paginationService.deregisterInstance(paginationId);
118+
// });
114119
};
115120
}
116121

src/directives/pagination/dirPagination.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ describe('dirPagination directive', function() {
11331133
compile();
11341134

11351135
var $list1 = containingElement.find('ul.list').eq(0);
1136-
var $list2 = containingElement.find('ul.list').eq(1);
1136+
var $list2 = containingElement.find('ul.list').eq(1);
11371137

11381138
expect(getListItems($list1)).toEqual([ '1', '2', '3' ]);
11391139
expect(getListItems($list2)).toEqual([ 'a', 'b', 'c' ]);

0 commit comments

Comments
 (0)