diff --git a/modules/customer-invoices/src/web/hooks/calcs/use-invoice-auto-recalc.ts b/modules/customer-invoices/src/web/hooks/calcs/use-invoice-auto-recalc.ts index 4405bb45..c1bb8ce9 100644 --- a/modules/customer-invoices/src/web/hooks/calcs/use-invoice-auto-recalc.ts +++ b/modules/customer-invoices/src/web/hooks/calcs/use-invoice-auto-recalc.ts @@ -96,7 +96,14 @@ export function useInvoiceAutoRecalc( const prev = itemCache.current.get(idx); const next = calculateItemTotals(item, deferredDiscount); - if (!prev || JSON.stringify(prev) !== JSON.stringify(next)) { + const itemHasChanges = + !prev || + prev.subtotal_amount !== next.subtotal_amount || + prev.total_amount !== next.total_amount || + prev.taxes_amount !== next.taxes_amount; + + //if (!prev || JSON.stringify(prev) !== JSON.stringify(next)) { <-- Costoso y poco preciso + if (itemHasChanges) { shouldUpdateHeader = true; itemCache.current.set(idx, next); setInvoiceItemTotals(form, idx, next);