Skip to content

Commit 17fe494

Browse files
fix(entity): add default options to entity adapter when undefined is passed (#3287)
1 parent c194adc commit 17fe494

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

modules/entity/src/create_adapter.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { createSelector } from '@ngrx/store';
21
import {
32
EntityDefinition,
43
Comparer,
@@ -17,9 +16,8 @@ export function createEntityAdapter<T>(
1716
} = {}
1817
): EntityAdapter<T> {
1918
const { selectId, sortComparer }: EntityDefinition<T> = {
20-
sortComparer: false,
21-
selectId: (instance: any) => instance.id,
22-
...options,
19+
selectId: options.selectId ?? ((entity: any) => entity.id),
20+
sortComparer: options.sortComparer ?? false,
2321
};
2422

2523
const stateFactory = createInitialStateFactory<T>();

0 commit comments

Comments
 (0)