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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 26x 26x 26x 26x 8x 16x 8x 26x 8x 26x 26x 4x 4x | import { EntityState, createEntityAdapter } from '@ngrx/entity'; import { createReducer, on } from '@ngrx/store'; import { CallParameters } from 'ish-core/models/call-parameters/call-parameters.model'; import { ContentPageletEntryPoint } from 'ish-core/models/content-pagelet-entry-point/content-pagelet-entry-point.model'; import { loadViewContextEntrypointSuccess } from './viewcontexts.actions'; declare type ContentPageletEntryPointWithContext = ContentPageletEntryPoint & { viewContextId: string; callParameters: CallParameters; }; export function serializeContextSpecificViewContextId(viewContextId: string, callParameters: CallParameters) { const serializedParams = callParameters ? Object.entries(callParameters) .sort() .map(([key, value]) => `@@${key}-${value}`) .join('') : ''; return viewContextId + serializedParams; } export const viewcontextsAdapter = createEntityAdapter<ContentPageletEntryPointWithContext>({ selectId: viewcontext => serializeContextSpecificViewContextId(viewcontext.viewContextId, viewcontext.callParameters), }); export type ViewcontextsState = EntityState<ContentPageletEntryPointWithContext>; const initialState: ViewcontextsState = viewcontextsAdapter.getInitialState({}); export const viewcontextsReducer = createReducer( initialState, on(loadViewContextEntrypointSuccess, (state, action) => { const { entrypoint, viewContextId, callParameters } = action.payload; return { ...viewcontextsAdapter.upsertOne({ ...entrypoint, viewContextId, callParameters }, state), }; }) ); |