Why won't the action value set in the state?

Discussão em 'Angular' iniciado por Mark Hill, Dezembro 11, 2024.

  1. Mark Hill

    Mark Hill Guest

    Given the following state

    export const initialState: State = {
    filters: {
    typeahead: [],
    },
    cases: [] as CaseData[],
    recordsReview: {} as DCMedicalRecordsReview,
    caseMetrics: {
    filter: {
    payer: '',
    lob: ''
    },
    providers: [],
    patients: []
    }
    }


    I am trying to pass a single string of data into the reducer and set it in the state

    on(CasesActions.setPayerFilter, (state, action) => ({
    ...state,
    caseMetrics: {
    ...state.caseMetrics,
    filter: {
    ...state.caseMetrics.filter,
    payer: action.payer
    }
    }
    })),


    This is done using the following action 'Set Payer Filter' : props<{ payer: string}>()

    When I attempt to display or log the set state, I receive an undefined. I am attempting to retrieve the information from the following selector:

    export const selecselectCaseMetricsFilterPayerCase = createSelector(
    casesFeature.selectCaseMetrics,
    (metrics) => metrics.filter.payer
    )


    Why is this coming up undefined?

    Continue reading...

Compartilhe esta Página