From 4e8ec5f4a2aef80642ebb04a6b36cc723dd9359f Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Wed, 15 Jan 2020 12:10:58 +0100 Subject: [PATCH 1/2] Fix history and bitstreamFormats store selector after moved in CoreState --- src/app/core/data/bitstream-format-data.service.ts | 6 +++++- src/app/core/history/selectors.ts | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/core/data/bitstream-format-data.service.ts b/src/app/core/data/bitstream-format-data.service.ts index b5c2b708dc..c30330a0a3 100644 --- a/src/app/core/data/bitstream-format-data.service.ts +++ b/src/app/core/data/bitstream-format-data.service.ts @@ -25,8 +25,12 @@ import { import { hasValue } from '../../shared/empty.util'; import { RequestEntry } from './request.reducer'; import { CoreState } from '../core.reducers'; +import { coreSelector } from '../core.selectors'; -const bitstreamFormatsStateSelector = (state: CoreState) => state.bitstreamFormats; +const bitstreamFormatsStateSelector = createSelector( + coreSelector, + (state: CoreState) => state.bitstreamFormats +); const selectedBitstreamFormatSelector = createSelector(bitstreamFormatsStateSelector, (bitstreamFormatRegistryState: BitstreamFormatRegistryState) => bitstreamFormatRegistryState.selectedBitstreamFormats); diff --git a/src/app/core/history/selectors.ts b/src/app/core/history/selectors.ts index a04d3839b1..5c77cd65f0 100644 --- a/src/app/core/history/selectors.ts +++ b/src/app/core/history/selectors.ts @@ -1,3 +1,8 @@ import { CoreState } from '../core.reducers'; +import { createSelector } from '@ngrx/store'; +import { coreSelector } from '../core.selectors'; -export const historySelector = (state: CoreState) => state.history; +export const historySelector = createSelector( + coreSelector, + (state: CoreState) => state.history +); From ddb787277b6a7b0f8fb8192b3e76f21d1d5b242b Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Fri, 17 Jan 2020 13:08:26 +0100 Subject: [PATCH 2/2] Fix failed test --- src/app/core/services/route.service.spec.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/core/services/route.service.spec.ts b/src/app/core/services/route.service.spec.ts index 525329d50f..07ff56d879 100644 --- a/src/app/core/services/route.service.spec.ts +++ b/src/app/core/services/route.service.spec.ts @@ -142,7 +142,11 @@ describe('RouteService', () => { describe('getHistory', () => { it('should dispatch AddUrlToHistoryAction on NavigationEnd event', () => { - serviceAsAny.store = observableOf({ history: ['url', 'newurl'] }); + serviceAsAny.store = observableOf({ + core: { + history: ['url', 'newurl'] + } + }); service.getHistory().subscribe((history) => { expect(history).toEqual(['url', 'newurl']);