Skip to content

Commit af5b980

Browse files
authored
Merge pull request #3671 from Northeastern-Electric-Racing/#3301-deleting-products-in-rr-overwrites-items
#3301: deleting products in edit reimbursement request no longer over…
2 parents 63448ba + f4dd08a commit af5b980

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const ReimbursementProductTable: React.FC<ReimbursementProductTableProps> = ({
8585
name: string;
8686
cost: number;
8787
index: number;
88+
id?: string;
8889
}[]
8990
>();
9091

@@ -104,9 +105,9 @@ const ReimbursementProductTable: React.FC<ReimbursementProductTableProps> = ({
104105
const productReason = hasWbsNum ? wbsPipe(product.reason as WbsNumber) : (product.reason as OtherProductReason).name;
105106
if (uniqueWbsElementsWithProducts.has(productReason)) {
106107
const products = uniqueWbsElementsWithProducts.get(productReason);
107-
products?.push({ ...product, index });
108+
products?.push({ ...product, index, id: product.id });
108109
} else {
109-
uniqueWbsElementsWithProducts.set(productReason, [{ ...product, index }]);
110+
uniqueWbsElementsWithProducts.set(productReason, [{ ...product, index, id: product.id }]);
110111
}
111112
});
112113

@@ -442,7 +443,7 @@ const ReimbursementProductTable: React.FC<ReimbursementProductTableProps> = ({
442443
)}
443444
</Box>
444445
{uniqueWbsElementsWithProducts.get(key)?.map((product) => (
445-
<ListItem key={product.index}>
446+
<ListItem key={product.id}>
446447
<Box sx={{ display: 'flex' }}>
447448
<Box
448449
sx={{

0 commit comments

Comments
 (0)