@@ -11,12 +11,18 @@ export default class ChargesList extends React.Component<Props> {
1111 const summarizedCharges = Object . entries (
1212 this . props . eligibleChargesByDate
1313 ) . map (
14- ( [ eligibilityDate , casesWithHeaderAndChargesNames ] : [ string , any [ ] ] ) => {
14+ (
15+ [ eligibilityDate , casesWithHeaderAndChargesNames ] : [ string , any [ ] ] ,
16+ summaryIdx
17+ ) => {
1518 const numCharges = casesWithHeaderAndChargesNames . reduce (
1619 ( acc : number , entry : any ) => acc + entry [ 1 ] . length ,
1720 0
1821 ) ;
19- const listItems = this . buildListItems ( casesWithHeaderAndChargesNames ) ;
22+ const listItems = this . buildListItems (
23+ casesWithHeaderAndChargesNames ,
24+ summaryIdx
25+ ) ;
2026 const categoryHeader = this . buildCategoryHeader (
2127 eligibilityDate ,
2228 numCharges
@@ -44,13 +50,16 @@ export default class ChargesList extends React.Component<Props> {
4450 ) ;
4551 }
4652
47- buildListItems ( casesWithHeaderAndChargesNames : any [ ] ) {
48- return casesWithHeaderAndChargesNames . map ( ( entry ) => {
53+ buildListItems ( casesWithHeaderAndChargesNames : any [ ] , summaryIdx : number ) {
54+ return casesWithHeaderAndChargesNames . map ( ( entry , groupIdx ) => {
4955 const [ caseHeaderWithBalance , chargesNames ] = entry ;
5056 const listItemsInCase = chargesNames . map (
5157 ( [ id , chargeName ] : [ string , string ] , index : number ) => {
5258 return (
53- < li key = { "chargeItem" + index } className = "f6 bb b--light-gray pv2" >
59+ < li
60+ key = { "chargeItem" + summaryIdx + "-" + groupIdx + "-" + index }
61+ className = "f6 bb b--light-gray pv2"
62+ >
5463 < a
5564 href = { "#" + id }
5665 className = {
@@ -63,19 +72,12 @@ export default class ChargesList extends React.Component<Props> {
6372 ) ;
6473 }
6574 ) ;
66- if ( caseHeaderWithBalance ) {
67- return (
68- < >
69- < li className = "fw7 pt2" > { caseHeaderWithBalance } </ li >
70- { listItemsInCase }
71- </ >
75+ if ( caseHeaderWithBalance ) {
76+ return [ < li className = "fw7 pt2" > { caseHeaderWithBalance } </ li > ] . concat (
77+ listItemsInCase
7278 ) ;
7379 } else {
74- return (
75- < >
76- { listItemsInCase }
77- </ >
78- ) ;
80+ return listItemsInCase ;
7981 }
8082 } ) ;
8183 }
0 commit comments