Skip to content

Commit 90899f7

Browse files
karptoniteMikeRyanDev
authored andcommitted
fix(Store): Remove auto-memoization of selector functions
This fixes situations where `Store.select()` would memoize a Reselect selector twice. Closes #118
1 parent bfdb83b commit 90899f7

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

modules/store/src/selector.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,3 @@ export function createFeatureSelector<T>(
139139

140140
return Object.assign(memoized, { release: reset });
141141
}
142-
143-
export function isSelector(v: any): v is MemoizedSelector<any, any> {
144-
return (
145-
typeof v === 'function' && v.release && typeof v.release === 'function'
146-
);
147-
}

modules/store/src/store.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { Action, ActionReducer } from './models';
99
import { ActionsSubject } from './actions_subject';
1010
import { StateObservable } from './state';
1111
import { ReducerManager } from './reducer_manager';
12-
import { isSelector, createSelector } from './selector';
1312

1413
@Injectable()
1514
export class Store<T> extends Observable<T> implements Observer<Action> {
@@ -70,10 +69,8 @@ export class Store<T> extends Observable<T> implements Observer<Action> {
7069

7170
if (typeof pathOrMapFn === 'string') {
7271
mapped$ = pluck.call(this, pathOrMapFn, ...paths);
73-
} else if (typeof pathOrMapFn === 'function' && isSelector(pathOrMapFn)) {
74-
mapped$ = map.call(this, pathOrMapFn);
7572
} else if (typeof pathOrMapFn === 'function') {
76-
mapped$ = map.call(this, createSelector(s => s, pathOrMapFn));
73+
mapped$ = map.call(this, pathOrMapFn);
7774
} else {
7875
throw new TypeError(
7976
`Unexpected type '${typeof pathOrMapFn}' in select operator,` +

0 commit comments

Comments
 (0)