diff --git a/jam-ui/src/store/features/peopleSlice.js b/jam-ui/src/store/features/peopleSlice.js index 73489cd1b..45e049ce2 100644 --- a/jam-ui/src/store/features/peopleSlice.js +++ b/jam-ui/src/store/features/peopleSlice.js @@ -68,10 +68,12 @@ export const peopleSlice = createSlice({ }, loadPrefetched: (state, action) => { if(state.prefetched.length > 0){ - const records = new Set([...state.people, ...state.prefetched]); - const unique = []; - records.map(x => unique.filter(a => a.id === x.id).length > 0 ? null : unique.push(x)) - state.people = unique + //const records = new Set([...state.people, ...state.prefetched]); + const records = [...state.people, ...state.prefetched]; + //const unique = []; + //records.map(x => unique.filter(a => a.id === x.id).length > 0 ? null : unique.push(x)) + //state.people = unique + state.people = records; } state.prefetched = [] } @@ -82,13 +84,16 @@ export const peopleSlice = createSlice({ state.status = 'loading' }) .addCase(fetchPeople.fulfilled, (state, action) => { - const records = new Set([...state.people, ...action.payload.musicians]); - const unique = []; - records.map(x => unique.filter(a => a.id === x.id).length > 0 ? null : unique.push(x)) - state.people = unique + //const records = new Set([...state.people, ...action.payload.musicians]); + const records = [...state.people, ...action.payload.musicians]; + //const unique = []; + //records.map(x => unique.filter(a => a.id === x.id).length > 0 ? null : unique.push(x)) + //state.people = unique + state.people = records //state.totalPages = action.payload.page_count state.hasOffset = !!action.payload.offset state.status = 'succeeded' + console.log('******fetchPeople.fulfilled -> state.people', state.people); }) .addCase(fetchPeople.rejected, (state, action) => { state.status = 'failed' @@ -97,12 +102,15 @@ export const peopleSlice = createSlice({ .addCase(preFetchPeople.pending, (state, action) => { }) .addCase(preFetchPeople.fulfilled, (state, action) => { - const records = new Set([...state.prefetched, ...action.payload.musicians]); - const unique = []; - records.map(x => unique.filter(a => a.id === x.id).length > 0 ? null : unique.push(x)) - state.prefetched = unique + //const records = new Set([...state.prefetched, ...action.payload.musicians]); + const records = [...state.prefetched, ...action.payload.musicians]; + //const unique = []; + //records.map(x => unique.filter(a => a.id === x.id).length > 0 ? null : unique.push(x)) + //state.prefetched = unique + state.prefetched = records //state.totalPages = action.payload.page_count state.hasOffset = !!action.payload.offset + console.log('******preFetchPeople.fulfilled -> state.prefetched', state.prefetched); }) .addCase(preFetchPeople.rejected, (state, action) => { })