fix(machines) : pièce supprimée ne bloque plus la machine
Auto Tag Develop / tag (push) Successful in 9s
Auto Tag Develop / tag (push) Successful in 9s
Un lien machine_piece_links orphelin (pieceid pointant vers une pièce
supprimée) faisait charger les documents via l'id du lien
(GET /documents/piece/{linkId}) → 404 + toast bloquant, et la catégorie
restait affichée à vide.
- front : useEntityDocuments ne charge plus les documents pour un node
pending (refreshDocuments + ensureDocumentsLoaded) + test
- back : migration Version20260529150000 réparant les 2 FK CASCADE vers
pieces (fk_mpl_piece, fk_cfv_piece) jamais appliquées par
Version20260528090000, avec nettoyage des orphelins (1 mpl + 3 cfv)
This commit is contained in:
@@ -56,7 +56,9 @@ export function useEntityDocuments(deps: EntityDocumentsDeps) {
|
||||
// CRUD operations
|
||||
const refreshDocuments = async () => {
|
||||
const e = entity()
|
||||
if (!e?.id || e._structurePiece) return
|
||||
// Pending / category-only nodes carry the link id (not a real entity id) and
|
||||
// have no backing piece/composant — never request documents for them.
|
||||
if (!e?.id || e._structurePiece || e.pendingEntity) return
|
||||
loadingDocuments.value = true
|
||||
try {
|
||||
const result: any = await loadDocumentsFn(e.id, { updateStore: false })
|
||||
@@ -70,7 +72,8 @@ export function useEntityDocuments(deps: EntityDocumentsDeps) {
|
||||
}
|
||||
|
||||
const ensureDocumentsLoaded = async () => {
|
||||
if (documentsLoaded.value || !entity()?.id) return
|
||||
const e = entity()
|
||||
if (documentsLoaded.value || !e?.id || e.pendingEntity) return
|
||||
await refreshDocuments()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user