diff --git a/modules/store/spec/selector.spec.ts b/modules/store/spec/selector.spec.ts index 75dd01acb0..75ac7e98a3 100644 --- a/modules/store/spec/selector.spec.ts +++ b/modules/store/spec/selector.spec.ts @@ -90,6 +90,7 @@ describe('Selectors', () => { selector(firstState); selector(firstState); selector(secondState); + selector(secondState); expect(incrementOne).toHaveBeenCalledTimes(2); expect(incrementTwo).toHaveBeenCalledTimes(2); @@ -201,6 +202,7 @@ describe('Selectors', () => { selector(firstState, props); selector(firstState, props); selector(secondState, props); + selector(secondState, props); expect(counter).toBe(2); expect(projectFn).toHaveBeenCalledTimes(2); @@ -322,6 +324,7 @@ describe('Selectors', () => { selector(firstState); selector(firstState); selector(secondState); + selector(secondState); expect(incrementOne).toHaveBeenCalledTimes(2); expect(incrementTwo).toHaveBeenCalledTimes(2); @@ -433,6 +436,7 @@ describe('Selectors', () => { selector(firstState, props); selector(firstState, props); selector(secondState, props); + selector(secondState, props); expect(counter).toBe(2); expect(projectFn).toHaveBeenCalledTimes(2); diff --git a/modules/store/src/selector.ts b/modules/store/src/selector.ts index 95c57200db..fba69f6450 100644 --- a/modules/store/src/selector.ts +++ b/modules/store/src/selector.ts @@ -70,13 +70,14 @@ export function defaultMemoize( return lastResult; } + lastArguments = arguments; + const newResult = projectionFn.apply(null, arguments); if (isResultEqual(lastResult, newResult)) { return lastResult; } lastResult = newResult; - lastArguments = arguments; return newResult; }