fix(ZapListRecord): use ImmutableList in the items property

environments/review-fix-show-m-jra93r/deployments/4702
P. Reis 3 months ago
parent a088fc1e55
commit 5a60df0a8a

@ -2,6 +2,7 @@ import {
Map as ImmutableMap, Map as ImmutableMap,
OrderedSet as ImmutableOrderedSet, OrderedSet as ImmutableOrderedSet,
Record as ImmutableRecord, Record as ImmutableRecord,
List as ImmutableList,
} from 'immutable'; } from 'immutable';
import { AnyAction } from 'redux'; import { AnyAction } from 'redux';
@ -98,7 +99,7 @@ export const ZapRecord = ImmutableRecord({
}); });
const ZapListRecord = ImmutableRecord({ const ZapListRecord = ImmutableRecord({
items: ImmutableOrderedSet<Zap>(), items: ImmutableList<Zap>(),
isLoading: false, isLoading: false,
}); });
@ -203,7 +204,7 @@ export default function userLists(state = ReducerRecord(), action: AnyAction) {
})); }));
case ZAPS_FETCH_SUCCESS: case ZAPS_FETCH_SUCCESS:
return state.setIn(['zapped_by', action.id], ZapListRecord({ return state.setIn(['zapped_by', action.id], ZapListRecord({
items: ImmutableOrderedSet<Zap>(action.zaps.map(({ account, ...zap }: APIEntity) => ZapRecord({ items: ImmutableList(action.zaps.map(({ account, ...zap }: APIEntity) => ZapRecord({
...zap, ...zap,
account: account.id, account: account.id,
}))), }))),

Loading…
Cancel
Save