fix(istruttoriaPratica): expandedInv array vuoto per DataTable con subheader
Runtime TypeError cliccando ▸ per espandere le note di una fattura:
'(collection || []).findIndex is not a function'
Causa: la DataTable fatture usa rowGroupMode='subheader' + groupRowsBy.
In questa modalita PrimeReact chiama expandedRows.findIndex(...) al toggle
della row. Il valore iniziale era {} (oggetto) — findIndex non esiste
sull'oggetto → crash alla prima espansione.
Fix: useState([]) invece di useState({}). Il reducer di onRowToggle
gestisce array/oggetto trasparentemente, ma il bootstrap deve essere
un array quando c'e rowGroupMode.
La tabella ULA (expandedUla) resta {} perche non usa subheader e
PrimeReact accetta entrambi i formati in quella configurazione.
Segnalazione Carlo (demo in corso).
This commit is contained in:
@@ -71,7 +71,10 @@ const IstruttoriaPratica = () => {
|
||||
const [previewDialog, setPreviewDialog] = useState({ visible: false, entityType: null, entityId: null, filename: null, title: null });
|
||||
const [docNoteDialog, setDocNoteDialog] = useState({ visible: false, doc: null, status: null });
|
||||
// tabelle: expanded rows + buffer modifiche inline
|
||||
const [expandedInv, setExpandedInv] = useState({});
|
||||
// Array vuoto (NON oggetto): in rowGroupMode='subheader' PrimeReact fa
|
||||
// findIndex su expandedRows, che fallisce con (collection || []).findIndex is not a function
|
||||
// se il valore iniziale e {}. La tabella ULA (senza subheader) accetta anche l'oggetto.
|
||||
const [expandedInv, setExpandedInv] = useState([]);
|
||||
const [expandedUla, setExpandedUla] = useState({});
|
||||
const [invDraft, setInvDraft] = useState({}); // { invoiceId: { amount_verified, notes } }
|
||||
const [ulaDraft, setUlaDraft] = useState({}); // { employeeId: { fte_pct_verified, notes } }
|
||||
|
||||
Reference in New Issue
Block a user