diff --git a/src/app/extensions/recently/store/recently/recently.reducer.ts b/src/app/extensions/recently/store/recently/recently.reducer.ts index b28d4983ea..82a4d06f37 100644 --- a/src/app/extensions/recently/store/recently/recently.reducer.ts +++ b/src/app/extensions/recently/store/recently/recently.reducer.ts @@ -6,7 +6,7 @@ import { addToRecently, clearRecently } from './recently.actions'; export type RecentlyViewedProducts = RecentlyViewedProduct[]; -const initialState: RecentlyViewedProducts = []; +export const initialState: RecentlyViewedProducts = []; export const recentlyReducer = createReducer( [], diff --git a/src/app/extensions/recently/store/recently/recently.selectors.ts b/src/app/extensions/recently/store/recently/recently.selectors.ts index 54c0028135..ae54cb8171 100644 --- a/src/app/extensions/recently/store/recently/recently.selectors.ts +++ b/src/app/extensions/recently/store/recently/recently.selectors.ts @@ -5,9 +5,9 @@ import { isArrayEqual } from 'ish-core/utils/functions'; import { getRecentlyState } from '../recently-store'; -import { RecentlyViewedProducts } from './recently.reducer'; +import { RecentlyViewedProducts, initialState } from './recently.reducer'; -const internalProducts = createSelector(getRecentlyState, state => state._recently); +const internalProducts = createSelector(getRecentlyState, state => state?._recently || initialState); export const getRecentlyViewedProducts = createSelectorFactory(projector => resultMemoize(projector, isArrayEqual) @@ -21,7 +21,7 @@ export const getRecentlyViewedProducts = createSelectorFactory ); /** - * Selector to get the most recent 4 products without the currently viewed product on product detail pages + * Selector to get the most recent 12 products without the currently viewed product on product detail pages */ export const getMostRecentlyViewedProducts = createSelector( getRecentlyViewedProducts,