Fix price display issues and layout in design review page
- Add defensive checks in cart store to handle missing/NaN unitPrice values - Display '—' for items with invalid prices instead of NaN - Fix design review page grid layout to align buttons at top of page - Ensure buttons don't get pushed below images on review page
This commit is contained in:
@@ -38,7 +38,10 @@ export const useCart = create<CartState>()(
|
||||
),
|
||||
})),
|
||||
clear: () => set({ items: [] }),
|
||||
total: () => get().items.reduce((sum, i) => sum + i.unitPrice * i.quantity, 0),
|
||||
total: () => get().items.reduce((sum, i) => {
|
||||
const price = typeof i.unitPrice === 'number' && !isNaN(i.unitPrice) ? i.unitPrice : 0;
|
||||
return sum + price * i.quantity;
|
||||
}, 0),
|
||||
}),
|
||||
{
|
||||
name: 'personalize-studio-cart',
|
||||
|
||||
Reference in New Issue
Block a user