primereact
primereact copied to clipboard
A TypeError is encountered when attempting to collapse any row after using the “Expand All” button in a table with expanded rows and row group mode
Describe the bug
A TypeError is encountered when attempting to collapse any row after using the “Expand All” button in a table with expanded rows and row group mode. The error occurs in the primereact_datatable.js file.
Reproducer
https://stackblitz.com/edit/q52q3u?file=src%2FApp.jsx
PrimeReact version
10.6.6
React version
18.x
Language
ALL
Build / Runtime
Next.js
Browser(s)
Chrome 126
Steps to reproduce the behavior
- Use a DataTable with expanded rows and row group mode as per the provided code example.
- Click on the “Expand All” button to expand all rows.
- Try to collapse any of the expanded rows.
- Observe the console error.
primereact_datatable.js?v=7b9c8279:8812 Uncaught TypeError: (collection || []).findIndex is not a function at findIndex2 (primereact_datatable…?v=7b9c8279:8812:31) at Object.onRowToggle2 [as onRowToggle] (primereact_datatable…?v=7b9c8279:9254:30) at onRowToggle2 (primereact_datatable…?v=7b9c8279:7674:11) at HTMLUnknownElement.callCallback2 (chunk-3AYKYWEJ.js?v=c0490a77:3674:22) at Object.invokeGuardedCallbackDev (chunk-3AYKYWEJ.js?v=c0490a77:3699:24) at invokeGuardedCallback (chunk-3AYKYWEJ.js?v=c0490a77:3733:39) at invokeGuardedCallbackAndCatchFirstError (chunk-3AYKYWEJ.js?v=c0490a77:3736:33) at executeDispatch (chunk-3AYKYWEJ.js?v=c0490a77:7014:11) at processDispatchQueueItemsInOrder (chunk-3AYKYWEJ.js?v=c0490a77:7034:15) at processDispatchQueue (chunk-3AYKYWEJ.js?v=c0490a77:7043:13)
Expected behavior
Rows should be able to collapse without any errors.