From d2769094884a4578a046b245a32f5dce770bfe3b Mon Sep 17 00:00:00 2001 From: AlexeerCT Date: Sun, 11 Jan 2026 00:00:45 -0600 Subject: [PATCH] refactor: remove console.log statements and unnecessary logging in various components --- .../v1/modules/a24/fa/fa_classes/service.py | 8 --- backend/api/v1/modules/a76/classes/routes.py | 3 - backend/api/v1/modules/a76/classes/service.py | 11 --- backend/api/v1/modules/a76/items/service.py | 27 +------ .../api/v1/modules/core/licenses/service.py | 1 - .../api/v1/modules/core/tenants/service.py | 5 -- backend/core/error_handlers.py | 1 - .../classes/forms/FixedAssetClassForm.svelte | 15 ++-- .../modales/client-selector-dialog.svelte | 3 +- .../dashboard/goods/parts/partForm.svelte | 6 +- .../dashboard/invoices/edit/save-invoice.ts | 16 ++--- .../edit/digitization-tab-form.svelte | 12 ++-- .../pedimentos/edit/general-tab-form.svelte | 7 +- .../package-transportation-tab-form.svelte | 18 ++--- .../goods/fixed-asset-classes/+page.svelte | 71 ++++++------------- .../dashboard/invoices/edit/[id]/+page.svelte | 11 +-- .../pedimentos/edit/[id]/+page.svelte | 10 +-- 17 files changed, 51 insertions(+), 174 deletions(-) diff --git a/backend/api/v1/modules/a24/fa/fa_classes/service.py b/backend/api/v1/modules/a24/fa/fa_classes/service.py index 4a5caacf..59362ff9 100644 --- a/backend/api/v1/modules/a24/fa/fa_classes/service.py +++ b/backend/api/v1/modules/a24/fa/fa_classes/service.py @@ -129,10 +129,6 @@ class FAClassService: db.commit() db.refresh(new_fa_class) - logger.info( - f"Created fixed asset class {new_fa_class.id} for class_id {new_fa_class.class_id}" - ) - return new_fa_class except IntegrityError as e: @@ -175,8 +171,6 @@ class FAClassService: db.commit() db.refresh(fa_class) - logger.info(f"Updated fixed asset class {fa_class_id}") - return fa_class except IntegrityError as e: @@ -208,8 +202,6 @@ class FAClassService: db.delete(fa_class) db.commit() - logger.info(f"Deleted fixed asset class {fa_class_id}") - except IntegrityError as e: db.rollback() logger.error(f"IntegrityError deleting fixed asset class: {str(e)}") diff --git a/backend/api/v1/modules/a76/classes/routes.py b/backend/api/v1/modules/a76/classes/routes.py index fb3d3d65..c59dd575 100644 --- a/backend/api/v1/modules/a76/classes/routes.py +++ b/backend/api/v1/modules/a76/classes/routes.py @@ -45,9 +45,6 @@ async def create_fa_class( current_user: Dict[str, Any] = Depends(get_current_user), ): """Create a fixed asset class (both base class and FA extension)""" - import logging - logger = logging.getLogger(__name__) - logger.info(f"create_fa_class endpoint called with: {class_data.model_dump()}") tenant_id = validate_access_to_resource(db, company_id, current_user) diff --git a/backend/api/v1/modules/a76/classes/service.py b/backend/api/v1/modules/a76/classes/service.py index d8ecc25f..a4c3fd1b 100644 --- a/backend/api/v1/modules/a76/classes/service.py +++ b/backend/api/v1/modules/a76/classes/service.py @@ -40,7 +40,6 @@ class ClassService: """ Get all classes for a tenant with pagination and filters """ - logger.info(f"get_all called with tenant_id={tenant_id}, company_id={company_id}, skip={skip}, limit={limit}") query = db.query(Class).filter( Class.tenant_id == tenant_id, Class.company_id == company_id ) @@ -72,7 +71,6 @@ class ClassService: total = query.count() items = query.offset(skip).limit(limit).all() - logger.info(f"get_all returning {len(items)} items out of {total} total") return items, total @staticmethod @@ -149,8 +147,6 @@ class ClassService: company_id: int, ) -> Optional[Class]: """Update a class""" - logger.info(f"Update called for class_id={class_id}, tenant_id={tenant_id}, company_id={company_id}") - logger.info(f"Update data received: {class_data.model_dump(exclude_unset=True)}") class_obj = ClassService.get_by_id(db, class_id, tenant_id, company_id) if not class_obj: @@ -158,7 +154,6 @@ class ClassService: return None update_data = class_data.model_dump(exclude_unset=True) - logger.info(f"Update data after model_dump: {update_data}") # Validate material_key exists if provided if "material_key" in update_data and update_data["material_key"]: @@ -182,7 +177,6 @@ class ClassService: Class.id != class_id # Exclude current class ).first() - logger.info(f"Checking for duplicate class_code '{new_code}'") if existing_class: logger.warning(f"Duplicate class_code found: {existing_class.id}") raise HTTPException( @@ -194,10 +188,8 @@ class ClassService: setattr(class_obj, field, value) try: - logger.info(f"Attempting to commit changes for class {class_id}") db.commit() db.refresh(class_obj) - logger.info(f"Successfully updated class {class_id}") return class_obj except IntegrityError as e: db.rollback() @@ -253,9 +245,6 @@ class ClassService: Create a fixed asset class (both a76.classes and a24.fa_classes) Returns a dict with both records combined """ - import logging - logger = logging.getLogger(__name__) - logger.info(f"create_fa_class called with data: {class_data.model_dump()}") from api.v1.modules.a24.fa.fa_classes.models import QClasses diff --git a/backend/api/v1/modules/a76/items/service.py b/backend/api/v1/modules/a76/items/service.py index 74ba2da1..12bf0dbf 100644 --- a/backend/api/v1/modules/a76/items/service.py +++ b/backend/api/v1/modules/a76/items/service.py @@ -147,12 +147,6 @@ class ItemService: lines_data = item_data.lines or [] item_dict = item_data.model_dump(exclude={"lines"}) - # DEBUG: Log incoming data - print(f"\n🔍 DEBUG CREATE ITEM:") - print(f" Item data: {item_dict}") - print(f" Lines count: {len(lines_data)}") - print(f" Tenant ID: {tenant_id}, Company ID: {company_id}") - # Add tenant and company item_dict["tenant_id"] = tenant_id item_dict["company_id"] = company_id @@ -162,11 +156,8 @@ class ItemService: db.add(db_item) db.flush() # Get the item ID - print(f" ✅ Item created with ID: {db_item.id}") - # Create line items if provided for idx, line_data in enumerate(lines_data): - print(f"\n 📝 Processing line {idx + 1}/{len(lines_data)}") # Extract nested data from line financial_data = line_data.financial quantity_data = line_data.quantity @@ -174,13 +165,6 @@ class ItemService: description_data = line_data.description reference_data = line_data.reference - print(f" Line data: {line_data.model_dump()}") - print(f" Has financial: {financial_data is not None}") - print(f" Has quantity: {quantity_data is not None}") - print(f" Has customs: {customs_data is not None}") - print(f" Has description: {description_data is not None}") - print(f" Has reference: {reference_data is not None}") - line_dict = line_data.model_dump( exclude={ "financial", @@ -198,7 +182,6 @@ class ItemService: db_line = LineItem(**line_dict) db.add(db_line) db.flush() # Get the line ID - print(f" ✅ Line created with ID: {db_line.id}") # Create financial data if provided if financial_data: @@ -206,7 +189,6 @@ class ItemService: financial_dict["item_line_id"] = db_line.id db_financial = LineFinancial(**financial_dict) db.add(db_financial) - print(f" ✅ Financial data added") # Create quantity data if provided if quantity_data: @@ -214,7 +196,6 @@ class ItemService: quantity_dict["item_line_id"] = db_line.id db_quantity = LineQuantity(**quantity_dict) db.add(db_quantity) - print(f" ✅ Quantity data added") # Create customs data if provided if customs_data: @@ -222,7 +203,6 @@ class ItemService: customs_dict["item_line_id"] = db_line.id db_customs = LineCustom(**customs_dict) db.add(db_customs) - print(f" ✅ Customs data added") # Create description data if provided if description_data: @@ -230,20 +210,17 @@ class ItemService: description_dict["item_line_id"] = db_line.id db_description = LineDescription(**description_dict) db.add(db_description) - print(f" ✅ Description data added") - + # Create reference data if provided if reference_data: reference_dict = reference_data.model_dump() reference_dict["item_line_id"] = db_line.id db_reference = LineReference(**reference_dict) db.add(db_reference) - print(f" ✅ Reference data added") - print(f"\n 💾 Committing transaction...") db.commit() db.refresh(db_item) - print(f" ✅ Transaction committed successfully!") + return db_item except IntegrityError as e: diff --git a/backend/api/v1/modules/core/licenses/service.py b/backend/api/v1/modules/core/licenses/service.py index 8c379e19..0c3933a7 100644 --- a/backend/api/v1/modules/core/licenses/service.py +++ b/backend/api/v1/modules/core/licenses/service.py @@ -130,7 +130,6 @@ class LicenseService: try: self.db.commit() self.db.refresh(license) - logger.info(f"License updated for tenant {tenant_id}") return LicenseResponseDTO.model_validate(license) except Exception as e: self.db.rollback() diff --git a/backend/api/v1/modules/core/tenants/service.py b/backend/api/v1/modules/core/tenants/service.py index c3169e75..112226e0 100644 --- a/backend/api/v1/modules/core/tenants/service.py +++ b/backend/api/v1/modules/core/tenants/service.py @@ -62,8 +62,6 @@ class TenantService: self.db.commit() self.db.refresh(db_tenant) - logger.info(f"Tenant created: {db_tenant.id} - {db_tenant.name}") - return TenantResponseDTO.model_validate(db_tenant) except IntegrityError as e: @@ -148,7 +146,6 @@ class TenantService: try: self.db.commit() self.db.refresh(tenant) - logger.info(f"Tenant updated: {tenant_id}") return TenantResponseDTO.model_validate(tenant) except Exception as e: self.db.rollback() @@ -174,7 +171,6 @@ class TenantService: try: self.db.commit() - logger.info(f"Tenant deleted (soft): {tenant_id}") return True except Exception as e: self.db.rollback() @@ -204,7 +200,6 @@ class TenantService: try: self.db.commit() self.db.refresh(tenant) - logger.info(f"Tenant upgraded to dedicated DB: {tenant_id}") return TenantResponseDTO.model_validate(tenant) except Exception as e: self.db.rollback() diff --git a/backend/core/error_handlers.py b/backend/core/error_handlers.py index f07687b7..4fe62025 100644 --- a/backend/core/error_handlers.py +++ b/backend/core/error_handlers.py @@ -176,4 +176,3 @@ def register_exception_handlers(app) -> None: app.add_exception_handler(SQLAlchemyError, sqlalchemy_error_handler) app.add_exception_handler(Exception, general_exception_handler) - logger.info("Exception handlers registered successfully") diff --git a/frontend/src/lib/components/dashboard/goods/classes/forms/FixedAssetClassForm.svelte b/frontend/src/lib/components/dashboard/goods/classes/forms/FixedAssetClassForm.svelte index 16632751..70d1315c 100644 --- a/frontend/src/lib/components/dashboard/goods/classes/forms/FixedAssetClassForm.svelte +++ b/frontend/src/lib/components/dashboard/goods/classes/forms/FixedAssetClassForm.svelte @@ -97,9 +97,7 @@ formData.import_tariff_code = snap.import_tariff_code ?? ''; formData.import_tariff_type = snap.import_tariff_type ?? ''; formData.export_tariff_code = snap.export_tariff_code ?? ''; - formData.export_tariff_type = snap.export_tariff_type ?? ''; - - console.log('FormData updated with initialData snapshot:', formData); + formData.export_tariff_type = snap.export_tariff_type ?? ''; } else { // Reset form when initialData is null (new class) formData.class_code = ''; @@ -118,9 +116,7 @@ formData.import_tariff_code = ''; formData.import_tariff_type = ''; formData.export_tariff_code = ''; - formData.export_tariff_type = ''; - - console.log('FormData reset for new class'); + formData.export_tariff_type = ''; } }); @@ -507,16 +503,13 @@ showErrors = true; // Validar formulario - if (!validateForm()) { - console.log('Validación fallida:', validationErrors); + if (!validateForm()) { toast.error('Por favor, complete todos los campos obligatorios'); return; } // Tomamos una copia muerta de los datos actuales - const dataToSave = $state.snapshot(formData); - - console.log('Enviando datos al padre:', dataToSave); + const dataToSave = $state.snapshot(formData); // Ejecutamos el onSave pasándole la copia if (onSave) { diff --git a/frontend/src/lib/components/dashboard/goods/modales/client-selector-dialog.svelte b/frontend/src/lib/components/dashboard/goods/modales/client-selector-dialog.svelte index 65399818..fadd2e9a 100644 --- a/frontend/src/lib/components/dashboard/goods/modales/client-selector-dialog.svelte +++ b/frontend/src/lib/components/dashboard/goods/modales/client-selector-dialog.svelte @@ -64,8 +64,7 @@ } // --- FUNCIÓN DE SELECCIÓN --- - function handleSelect(client: ClientProvider) { - console.log("Seleccionando cliente:", client.name); + function handleSelect(client: ClientProvider) { if (onSelect) { onSelect(client); } diff --git a/frontend/src/lib/components/dashboard/goods/parts/partForm.svelte b/frontend/src/lib/components/dashboard/goods/parts/partForm.svelte index 9e5f34c8..7ca3bc80 100644 --- a/frontend/src/lib/components/dashboard/goods/parts/partForm.svelte +++ b/frontend/src/lib/components/dashboard/goods/parts/partForm.svelte @@ -149,7 +149,7 @@ selectedClientName = clientData.name; selectedClientStatus = clientData.is_active ?? true; } - } catch (e) { console.log("Error visual cliente", e); } + } catch (e) { console.error("Error visual cliente", e); } } async function fetchClassDesc(code: string, companyId: number) { @@ -161,7 +161,7 @@ const found = list.find((i: any) => i.class_code === code) || list[0]; selectedClassDesc = found.description_es || found.description_en || ""; } - } catch (e) { console.log("Error visual clase", e); } + } catch (e) { console.error("Error visual clase", e); } } async function fetchMaterialName(key: string) { @@ -171,7 +171,7 @@ const list = data.items || []; const found = list.find((m: any) => m.key === key); if (found) selectedMaterialDesc = found.description; - } catch (e) { console.log("Error visual material", e); } + } catch (e) { console.error("Error visual material", e); } } // --- HANDLERS --- diff --git a/frontend/src/lib/components/dashboard/invoices/edit/save-invoice.ts b/frontend/src/lib/components/dashboard/invoices/edit/save-invoice.ts index a254ab2e..a685741a 100644 --- a/frontend/src/lib/components/dashboard/invoices/edit/save-invoice.ts +++ b/frontend/src/lib/components/dashboard/invoices/edit/save-invoice.ts @@ -73,13 +73,11 @@ export async function saveInvoice(options: SaveInvoiceOptions): Promise d.linea)) + 1 @@ -144,11 +143,8 @@ observaciones: '', e_document: '', numero_operacion_vu: '' - }; - console.log('🔵 Abriendo dialog de digitalización, isDialogOpen antes:', isDialogOpen); - isDialogOpen = true; - console.log('🔵 isDialogOpen después:', isDialogOpen); - console.log('🟢 FIN openNewDigitalizacion'); + }; + isDialogOpen = true; } function openEditDigitalizacion(index: number) { @@ -245,7 +241,7 @@ } } catch (error) { // Usuario canceló la selección - console.log('Selección de archivo cancelada'); + console.error('Selección de archivo cancelada: ', error); } } diff --git a/frontend/src/lib/components/dashboard/pedimentos/edit/general-tab-form.svelte b/frontend/src/lib/components/dashboard/pedimentos/edit/general-tab-form.svelte index 94fa3d79..99f50cce 100644 --- a/frontend/src/lib/components/dashboard/pedimentos/edit/general-tab-form.svelte +++ b/frontend/src/lib/components/dashboard/pedimentos/edit/general-tab-form.svelte @@ -284,13 +284,10 @@ (entryDate !== lastFetchedDate || companyId !== lastCompanyId)) { lastFetchedDate = entryDate; - lastCompanyId = companyId; - - console.log('🔍 [TIPO CAMBIO] Buscando para fecha:', entryDate, 'Company ID:', companyId); + lastCompanyId = companyId; getExchangeRateByDate(entryDate, companyId) - .then(usdRate => { - console.log('✅ [TIPO CAMBIO] Respuesta recibida:', usdRate); + .then(usdRate => { if (usdRate && formData) { formData.exchange_rate = usdRate.value; } else { diff --git a/frontend/src/lib/components/dashboard/pedimentos/edit/package-transportation-tab-form.svelte b/frontend/src/lib/components/dashboard/pedimentos/edit/package-transportation-tab-form.svelte index 45d70c96..0edd271b 100644 --- a/frontend/src/lib/components/dashboard/pedimentos/edit/package-transportation-tab-form.svelte +++ b/frontend/src/lib/components/dashboard/pedimentos/edit/package-transportation-tab-form.svelte @@ -108,8 +108,7 @@ } if (pedimento && !dataLoaded) { - dataLoaded = true; - console.log('📦 Cargando datos del pedimento en package-transportation-tab-form'); + dataLoaded = true; // Cargar datos de bultos desde pedimento_packages if (pedimento.pedimento_packages) { @@ -166,21 +165,13 @@ identificacion: c.identification || '', tipo: c.type || '' })); - } - - console.log('✅ Datos cargados en formData:', { - bultos: formData.bultos, - transportes: formData.transportes.length, - precintos: formData.precintos.length, - contenedores: formData.contenedores.length - }); + } } }); // Cargar países al montar el componente onMount(async () => { - try { - console.log('🌍 Cargando todos los países desde la base de datos...'); + try { const response = await fetch('/api-sveltekit/countries'); if (!response.ok) { @@ -189,8 +180,7 @@ } const data = await response.json(); - countries = data; - console.log('✅ Países cargados:', countries.length); + countries = data; } catch (error) { console.error('❌ Error al cargar países:', error); } diff --git a/frontend/src/routes/dashboard/goods/fixed-asset-classes/+page.svelte b/frontend/src/routes/dashboard/goods/fixed-asset-classes/+page.svelte index 2224b5a7..8a8acf8d 100644 --- a/frontend/src/routes/dashboard/goods/fixed-asset-classes/+page.svelte +++ b/frontend/src/routes/dashboard/goods/fixed-asset-classes/+page.svelte @@ -79,14 +79,12 @@ async function loadClasses() { const companyId = companyStore.activeCompany?.id; - if (!companyId) { - console.log('No company selected, skipping load'); + if (!companyId) { return; } isLoading = true; - try { - console.log('Cargando clases para company:', companyId); + try { const response = await classesApi.list({ company_id: companyId, page: 1, @@ -122,8 +120,7 @@ }) ); - classes = classesWithFA; - console.log('Clases cargadas:', classes.length); + classes = classesWithFA; } catch (error) { console.error('Error cargando clases:', error); toast.error('Error al cargar las clases de activo fijo'); @@ -147,13 +144,11 @@ }; } - async function saveFixedAssetClass(formData: any) { - console.log('=== INICIO saveFixedAssetClass ==='); + async function saveFixedAssetClass(formData: any) { const companyId = companyStore.activeCompany?.id; // CAMBIO: Usar $state.snapshot para obtener una copia real, no reactiva - const data = $state.snapshot(formData); - console.log('saveFixedAssetClass called with data:', data); + const data = $state.snapshot(formData); if (!companyId) { toast.error('No hay empresa seleccionada'); @@ -213,9 +208,7 @@ fda_code: data.fda_key || null, eccn_code: data.eccn_code || null, class_enabled: true - }; - - console.log('Sending payload:', payload); + }; const response = await classesApi.createFA(payload, companyId); @@ -231,15 +224,13 @@ isDuplicateError = true; } - // Mensaje más específico para errores de duplicado - console.log('isDuplicateError:', isDuplicateError); + // Mensaje más específico para errores de duplicado if (isDuplicateError) { validationError = `⚠️ ${errorMessage}\n\nPor favor, cambie el código de clase a uno diferente.`; } else { validationError = `⚠️ ${errorMessage}`; } - - console.log('MENSAJE ASIGNADO (save):', validationError); + toast.error(errorMessage, { duration: 8000 }); throw new Error(errorMessage); } @@ -256,14 +247,12 @@ } async function updateFixedAssetClass(formData: any) { - console.log('=== INICIO updateFixedAssetClass ==='); + const companyId = companyStore.activeCompany?.id; // CAMBIO 1: Usar $state.snapshot para obtener una copia real, no reactiva // Esto garantiza que aunque el hijo borre el formulario, 'data' mantenga los valores - const data = $state.snapshot(formData); - - console.log('updateFixedAssetClass called with snapshot data:', data); + const data = $state.snapshot(formData); if (!companyId || !selectedClass) { toast.error('No hay empresa o clase seleccionada'); @@ -351,15 +340,13 @@ console.error('Final error message:', errorMessage); console.error('Is duplicate error:', isDuplicateError); - // Mensaje más específico para errores de duplicado - console.log('isDuplicateError:', isDuplicateError); + // Mensaje más específico para errores de duplicado if (isDuplicateError) { validationError = `⚠️ ${errorMessage}\n\nPor favor, cambie el código de clase a uno diferente.`; } else { validationError = `⚠️ ${errorMessage}`; } - - console.log('MENSAJE ASIGNADO (update):', validationError); + toast.error(errorMessage, { duration: 8000 }); console.error('Toast shown, about to throw error'); @@ -683,18 +670,11 @@ onClearError={() => validationError = ''} onSave={async (data: Partial) => { // Evitar múltiples clics - if (isSaving) { - console.log('⚠️ Ya está guardando, ignorando clic'); + if (isSaving) { return; } isSaving = true; - validationError = ''; - - console.log('========================================'); - console.log('=== INICIO ONSAVE ==='); - console.log('Datos recibidos:', data); - console.log('selectedClass:', selectedClass); - console.log('========================================'); + validationError = ''; try { const cleanData = $state.snapshot(data); @@ -707,9 +687,7 @@ let response; if (selectedClass?.id) { - // === ACTUALIZACIÓN === - console.log('🔄 MODO: ACTUALIZACIÓN'); - console.log('ID de clase:', selectedClass.id); + // === ACTUALIZACIÓN === response = await classesApi.update(selectedClass.id, { class_code: cleanData.class_code?.trim() || '', @@ -729,11 +707,8 @@ throw new Error(response.error); } - console.log('✅ Actualización exitosa'); } else { - // === CREACIÓN === - console.log('➕ MODO: CREACIÓN'); - + // === CREACIÓN === const payload = { class_code: cleanData.class_code?.trim() || '', description_es: cleanData.description_es?.trim() || '', @@ -748,22 +723,17 @@ depreciation_rate: cleanData.depreciation_rate || null, fda_code: cleanData.fda_code || null, class_enabled: true - }; - - console.log('Payload:', payload); + }; response = await classesApi.createFA(payload, companyId); if (response.error) { console.error('❌ Error del servidor:', response.error); throw new Error(response.error); - } - - console.log('✅ Creación exitosa'); + } } - // === ÉXITO TOTAL === - console.log('✅ GUARDADO EXITOSO - Cerrando diálogo'); + // === ÉXITO TOTAL === const wasUpdate = !!selectedClass?.id; await loadClasses(); showInsertDialog = false; @@ -813,8 +783,7 @@ // NO cerramos el diálogo, permanece abierto } finally { - isSaving = false; - console.log('✅ isSaving = false'); + isSaving = false; } }} onCancel={() => { diff --git a/frontend/src/routes/dashboard/invoices/edit/[id]/+page.svelte b/frontend/src/routes/dashboard/invoices/edit/[id]/+page.svelte index 4db580c2..62065835 100644 --- a/frontend/src/routes/dashboard/invoices/edit/[id]/+page.svelte +++ b/frontend/src/routes/dashboard/invoices/edit/[id]/+page.svelte @@ -142,9 +142,7 @@ othersFormData, continuationFormData } - }); - - console.log('Save result:', result); + }); if (!result.success) { // Crear un error con validationErrors si existen @@ -157,9 +155,7 @@ toast.success('Todos los cambios se guardaron correctamente'); } catch (e) { - console.error('Error saving all:', e); - console.log('Error object:', e); - console.log('Has validationErrors?', (e as any)?.validationErrors); + console.error('Error saving all:', e); if (e instanceof Error && e.message.includes('401')) { toast.error('Sesión expirada. Recargando página...'); @@ -171,8 +167,7 @@ // Si hay errores de validación, mostrarlos en detalle if (e && typeof e === 'object' && 'validationErrors' in e && Array.isArray((e as any).validationErrors)) { - const validationErrors = (e as any).validationErrors; - console.log('Found validationErrors:', validationErrors); + const validationErrors = (e as any).validationErrors; const errorList = validationErrors.map((err: any) => `• ${err.field}: ${err.message}${err.solution ? ' - ' + err.solution.join(', ') : ''}` ).join('\n'); diff --git a/frontend/src/routes/dashboard/pedimentos/edit/[id]/+page.svelte b/frontend/src/routes/dashboard/pedimentos/edit/[id]/+page.svelte index 343179ab..1138594e 100644 --- a/frontend/src/routes/dashboard/pedimentos/edit/[id]/+page.svelte +++ b/frontend/src/routes/dashboard/pedimentos/edit/[id]/+page.svelte @@ -697,17 +697,13 @@ await goto(`/dashboard/pedimentos/edit/${newPedimentoId}`); return; } else { - // Actualizar pedimento existente con todos sus sub-recursos - console.log('🔍 Enviando cleanPayload:', cleanPayload); - const response = await pedimentosApi.update(pedimentoId!, cleanPayload as UpdatePedimentoData); - console.log('✅ Respuesta del servidor:', response); + // Actualizar pedimento existente con todos sus sub-recursos + const response = await pedimentosApi.update(pedimentoId!, cleanPayload as UpdatePedimentoData); if (response.error) throw new Error(response.error); - // Recargar los datos del pedimento desde el servidor - console.log('🔄 Recargando datos con invalidateAll...'); + // Recargar los datos del pedimento desde el servidor try { await invalidateAll(); - console.log('✅ invalidateAll completado'); // Forzar recarga de datos esperando un tick await new Promise(resolve => setTimeout(resolve, 100)); } catch (invalidateError) {