Skip to content

Commit

Permalink
fix(groupBy): fix bugs related to group resets
Browse files Browse the repository at this point in the history
When using durationSelector on groupBy operator, completed group
Observables were not being properly removed from the underlying Map of
groups by key. This fixes the following test cases:
- Observable.prototype.groupBy() should allow using a keySelector,
elementSelector, and durationSelector
- Observable.prototype.groupBy() should allow using a keySelector and a
durationSelector, outer throws
- Observable.prototype.groupBy() should allow using a durationSelector,
but keySelector throws
- Observable.prototype.groupBy() should allow using a durationSelector,
but elementSelector throws
- Observable.prototype.groupBy() should allow an inner to be unsubscribed
early but other inners continue, with durationSelector
- Observable.prototype.groupBy() should allow inners to be unsubscribed
early at different times, with durationSelector
- Observable.prototype.groupBy() should return inners that when subscribed
late exhibit hot behavior
  • Loading branch information
Andre Medeiros authored and benlesh committed Oct 13, 2015
1 parent cd37418 commit 23a7574
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/operators/groupBy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class GroupBySubscriber<T, R> extends Subscriber<T> {
}

removeGroup(key: string) {
this.groups[key] = null;
this.groups.delete(key);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/util/FastMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class FastMap {
forEach(cb, thisArg) {
const values = this._values;
for (let key in values) {
if (values.hasOwnProperty(key)) {
if (values.hasOwnProperty(key) && values[key] !== null) {
cb.call(thisArg, values[key], key);
}
}
Expand Down

0 comments on commit 23a7574

Please sign in to comment.