add artificial key for shopping_event_groceries
This commit is contained in:
@@ -158,7 +158,10 @@ const ShoppingEventForm: React.FC = () => {
|
||||
|
||||
const getGroceryName = (id: number) => {
|
||||
const grocery = groceries.find(g => g.id === id);
|
||||
return grocery ? grocery.name : 'Unknown';
|
||||
if (!grocery) return 'Unknown';
|
||||
|
||||
const weightInfo = grocery.weight ? `${grocery.weight}${grocery.weight_unit}` : grocery.weight_unit;
|
||||
return `${grocery.name} ${weightInfo}`;
|
||||
};
|
||||
|
||||
if (loadingEvent) {
|
||||
@@ -250,7 +253,7 @@ const ShoppingEventForm: React.FC = () => {
|
||||
<option value={0}>Select a grocery</option>
|
||||
{groceries.map(grocery => (
|
||||
<option key={grocery.id} value={grocery.id}>
|
||||
{grocery.name} ({grocery.category})
|
||||
{grocery.name} ({grocery.category}) {grocery.weight ? `${grocery.weight}${grocery.weight_unit}` : grocery.weight_unit}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user