Skip to content

Commit 518e561

Browse files
dummdidummbrandonroberts
authored andcommitted
feat(effects): add support for effects of different instances of same class (#1249)
Closes #1246
1 parent 1aa4b63 commit 518e561

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

modules/effects/spec/effect_sources.spec.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,23 @@ describe('EffectSources', () => {
9292
});
9393

9494
it('should ignore duplicate sources', () => {
95+
const sources$ = cold('--a--a--a--', {
96+
a: new SourceA(),
97+
});
98+
const expected = cold('--a--------', { a });
99+
100+
const output = toActions(sources$);
101+
102+
expect(output).toBeObservable(expected);
103+
});
104+
105+
it('should resolve effects from same class but different instances', () => {
95106
const sources$ = cold('--a--b--c--', {
96107
a: new SourceA(),
97108
b: new SourceA(),
98109
c: new SourceA(),
99110
});
100-
const expected = cold('--a--------', { a });
111+
const expected = cold('--a--a--a--', { a });
101112

102113
const output = toActions(sources$);
103114

modules/effects/src/effect_sources.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
} from 'rxjs/operators';
1212

1313
import { verifyOutput } from './effect_notification';
14-
import { getSourceForInstance } from './effects_metadata';
1514
import { resolveEffectSource } from './effects_resolver';
1615

1716
@Injectable()
@@ -29,7 +28,7 @@ export class EffectSources extends Subject<any> {
2928
*/
3029
toActions(): Observable<Action> {
3130
return this.pipe(
32-
groupBy(getSourceForInstance),
31+
groupBy(source => source),
3332
mergeMap(source$ =>
3433
source$.pipe(
3534
exhaustMap(resolveEffectSource),

0 commit comments

Comments
 (0)