Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 24x 24x 24x 24x 24x 24x 24x 24x 1x 1x 24x 1x | import { Dictionary } from '@ngrx/entity';
import { createSelector, createSelectorFactory, resultMemoize } from '@ngrx/store';
import { isEqual } from 'lodash-es';
import { ContentPagelet } from 'ish-core/models/content-pagelet/content-pagelet.model';
import { createContentPageletView } from 'ish-core/models/content-view/content-view.model';
import { getContentState } from 'ish-core/store/content/content-store';
import { pageletsAdapter } from './pagelets.reducer';
const getPageletsState = createSelector(getContentState, state => state.pagelets);
export const { selectEntities: getContentPageletEntities } = pageletsAdapter.getSelectors(getPageletsState);
const getContentPageletMemoized = (pageletId: string) =>
createSelectorFactory<object, ContentPagelet>(projector => resultMemoize(projector, isEqual))(
getContentPageletEntities,
(entities: Dictionary<ContentPagelet>) => entities[pageletId]
);
export const getContentPagelet = (pageletId: string) =>
createSelector(getContentPageletMemoized(pageletId), createContentPageletView);
|