fix: openEdit fetch ProductTypeDetail antes de abrir dialog (closes #37) #42

Merged
dmolinari merged 1 commits from fix/issue-37-openedit-fetch-detail into main 2026-04-19 19:53:47 +00:00
Owner

Summary

  • ProductTypesPage.openEdit() ahora llama queryClient.fetchQuery con getProductTypeById antes de abrir el dialog en modo edit
  • Todos los 4 campos multimedia (maxImages, maxImageSizeMB, maxImageWidth, maxImageHeight) se populan desde backend real, no stubs null
  • Botón Edit disabled durante el fetch
  • toast.error + dialog NO se abre si el fetch falla

Bug fixeado

Pre-fix: Edit en un ProductType con allowImages: true, maxImages: 5, ... abría el dialog con multimedia fields vacíos. Submit sin tocar esos fields sobreescribía la config con null silenciosamente.

Test plan

  • 4 tests nuevos en ProductTypesPage.test.tsx: fetch+open con multimedia populados, botón disabled durante fetch, error toast, preserve multimedia en submit
  • npx vitest run: 434 tests (431 pre-fix + 3 nuevos)
  • Backend no afectado (solo frontend)

Closes

Closes #37

Artifacts

  • Issue #37 — tracking de PRD-001 W_OPENEDIT warning
  • Verify-report PRD-001 (engram sdd/prd-001-product-type-flags-multimedia/verify-report)
## Summary - `ProductTypesPage.openEdit()` ahora llama `queryClient.fetchQuery` con `getProductTypeById` antes de abrir el dialog en modo edit - Todos los 4 campos multimedia (`maxImages`, `maxImageSizeMB`, `maxImageWidth`, `maxImageHeight`) se populan desde backend real, no stubs null - Botón Edit disabled durante el fetch - `toast.error` + dialog NO se abre si el fetch falla ## Bug fixeado Pre-fix: Edit en un `ProductType` con `allowImages: true, maxImages: 5, ...` abría el dialog con multimedia fields vacíos. Submit sin tocar esos fields sobreescribía la config con null silenciosamente. ## Test plan - [x] 4 tests nuevos en `ProductTypesPage.test.tsx`: fetch+open con multimedia populados, botón disabled durante fetch, error toast, preserve multimedia en submit - [x] `npx vitest run`: **434 tests** (431 pre-fix + 3 nuevos) - [x] Backend no afectado (solo frontend) ## Closes Closes #37 ## Artifacts - Issue #37 — tracking de PRD-001 W_OPENEDIT warning - Verify-report PRD-001 (engram `sdd/prd-001-product-type-flags-multimedia/verify-report`)
dmolinari added 1 commit 2026-04-19 19:53:44 +00:00
Reemplaza el stub con nulls por queryClient.fetchQuery con getProductTypeById,
deshabilitando el botón durante la carga y mostrando toast.error si falla.
dmolinari merged commit c5a8cd9edd into main 2026-04-19 19:53:47 +00:00
dmolinari deleted branch fix/issue-37-openedit-fetch-detail 2026-04-19 19:53:47 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dmolinari/SIG-CM2.0#42