Reputation: 627
I am using below selector:
export const selectorPersonData = createSelector(featureSelector, (state, props) => {
try {
return state.departmentData.filter(filt => filt.currentPosition.jobId === props.workSelectProps)
.map(job => job.assignedJob
.map(item => item.dealId));
} catch (e) {
return null;
}
});
In returning I got [[idA,idB]]
I tried a lot of solution with flatMap etc... but I did not get:
[idA, idB]
And I would like to get that data from selector.
And there are a double map. Nested Maps.
Map<namePersons, Map<workData, InformationModel>>>
Upvotes: 1
Views: 221
Reputation: 2738
Since you have nested map
calls you will get nested arrays. You will need to flatten the returned arrays to get the desired results.
Try:
return [].concat.apply([], state.departmentData.filter(filt => filt.currentPosition.jobId === props.workSelectProps)
.map(job => job.assignedJob
.map(item => item.dealId)));
HTH
Upvotes: 1