FIX: CRITICAL use nullish coalescing for product quantity in useMarket composable

- Updated the quantity assignment in the useMarket composable to use nullish coalescing (??) instead of logical OR (||). This change ensures that a quantity of 0 is preserved, preventing unintended defaults when productData.quantity is explicitly set to 0.

These changes improve the accuracy of product quantity handling in the market module.
This commit is contained in:
padreug 2025-10-02 09:37:42 +02:00
parent b69be281f3
commit 0447549fa5
2 changed files with 29 additions and 2 deletions

View file

@ -310,7 +310,7 @@ export function useMarket() {
description: productData.description || '',
price: productData.price || 0,
currency: productData.currency || 'sats',
quantity: productData.quantity || 1,
quantity: productData.quantity ?? 1, // Use nullish coalescing to preserve 0
images: productData.images || [],
categories: categories,
createdAt: latestEvent.created_at,
@ -502,7 +502,7 @@ export function useMarket() {
description: productData.description || '',
price: productData.price || 0,
currency: productData.currency || 'sats',
quantity: productData.quantity || 1,
quantity: productData.quantity ?? 1, // Use nullish coalescing to preserve 0
images: productData.images || [],
categories: categories,
createdAt: event.created_at,