diff --git a/modules/effects/spec/effect_sources.spec.ts b/modules/effects/spec/effect_sources.spec.ts index a30cac450b..ca606ab066 100644 --- a/modules/effects/spec/effect_sources.spec.ts +++ b/modules/effects/spec/effect_sources.spec.ts @@ -92,12 +92,23 @@ describe('EffectSources', () => { }); it('should ignore duplicate sources', () => { + const sources$ = cold('--a--a--a--', { + a: new SourceA(), + }); + const expected = cold('--a--------', { a }); + + const output = toActions(sources$); + + expect(output).toBeObservable(expected); + }); + + it('should resolve effects from same class but different instances', () => { const sources$ = cold('--a--b--c--', { a: new SourceA(), b: new SourceA(), c: new SourceA(), }); - const expected = cold('--a--------', { a }); + const expected = cold('--a--a--a--', { a }); const output = toActions(sources$); diff --git a/modules/effects/src/effect_sources.ts b/modules/effects/src/effect_sources.ts index 035e68a5f0..e831d07656 100644 --- a/modules/effects/src/effect_sources.ts +++ b/modules/effects/src/effect_sources.ts @@ -11,7 +11,6 @@ import { } from 'rxjs/operators'; import { verifyOutput } from './effect_notification'; -import { getSourceForInstance } from './effects_metadata'; import { resolveEffectSource } from './effects_resolver'; @Injectable() @@ -29,7 +28,7 @@ export class EffectSources extends Subject { */ toActions(): Observable { return this.pipe( - groupBy(getSourceForInstance), + groupBy(source => source), mergeMap(source$ => source$.pipe( exhaustMap(resolveEffectSource),