Skip to content

Commit

Permalink
fix(entity): add default options to entity adapter when undefined is …
Browse files Browse the repository at this point in the history
…passed (#3287)
  • Loading branch information
markostanimirovic authored Jan 17, 2022
1 parent c194adc commit 17fe494
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions modules/entity/src/create_adapter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { createSelector } from '@ngrx/store';
import {
EntityDefinition,
Comparer,
Expand All @@ -17,9 +16,8 @@ export function createEntityAdapter<T>(
} = {}
): EntityAdapter<T> {
const { selectId, sortComparer }: EntityDefinition<T> = {
sortComparer: false,
selectId: (instance: any) => instance.id,
...options,
selectId: options.selectId ?? ((entity: any) => entity.id),
sortComparer: options.sortComparer ?? false,
};

const stateFactory = createInitialStateFactory<T>();
Expand Down

0 comments on commit 17fe494

Please sign in to comment.