From 651a7dffc2af8952367adecfc80ad478b610ee14 Mon Sep 17 00:00:00 2001 From: jucasoft Date: Mon, 22 Jan 2024 15:31:52 +0100 Subject: [PATCH] Update state_selectors.ts --- .../ngrx-entity-crud/src/lib/state_selectors.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/projects/ngrx-entity-crud/src/lib/state_selectors.ts b/projects/ngrx-entity-crud/src/lib/state_selectors.ts index 9e69254..5cbacbd 100755 --- a/projects/ngrx-entity-crud/src/lib/state_selectors.ts +++ b/projects/ngrx-entity-crud/src/lib/state_selectors.ts @@ -23,12 +23,15 @@ export function getCrudBaseSelectors( const selectLastCriteria: MemoizedSelector = createSelector(selectState, getLastCriteria); const selectResponses: MemoizedSelector[]> = createSelector(selectState, getRespones); + const selectItemSelected: MemoizedSelector = createSelector(selectState, getItemSelected) as MemoizedSelector; + return { selectError, selectIsLoading, selectIsLoaded, selectLastCriteria, selectResponses, + selectItemSelected }; } @@ -40,7 +43,8 @@ export function getSingeCrudSelectors( selectIsLoading, selectIsLoaded, selectLastCriteria, - selectResponses + selectResponses, + selectItemSelected } = getCrudBaseSelectors(selectState); const selectItem: MemoizedSelector = createSelector(selectState, getItem) as MemoizedSelector @@ -50,7 +54,8 @@ export function getSingeCrudSelectors( selectIsLoading, selectIsLoaded, selectLastCriteria, - selectResponses + selectResponses, + selectItemSelected }; } @@ -64,7 +69,6 @@ export function createCrudSelectorsFactory(adapter) { getFilters ); - const selectItemSelected: MemoizedSelector = createSelector(selectState, getItemSelected) as MemoizedSelector; const selectEntitiesSelected: MemoizedSelector> = createSelector(selectState, getEntitiesSelected) as MemoizedSelector> const selectItemsSelected: MemoizedSelector = createSelector(selectEntitiesSelected, (entities: Dictionary) => Object.values(entities)) as MemoizedSelector @@ -76,7 +80,8 @@ export function createCrudSelectorsFactory(adapter) { selectIsLoading, selectIsLoaded, selectLastCriteria, - selectResponses + selectResponses, + selectItemSelected } = getCrudBaseSelectors(selectState); const {