1

I am using [email protected] and @types/[email protected] Together with react-table-config.d.ts from this answer.

In my project, I have a table that uses the useExpanded plugin and works perfectly. But when I add useRowSelect and toggleRowSelected is called it crashes. I tried to create a simple example of that error with js but I couldn't.

Things I tried:

  • Setting selectedRowIds manually using the initialState of the table works.

  • Adding the useGroupBy plugin doesn't help. I thought it might help since the error is related to isGrouped.

  • Using toggleRowSelected(rowId) instead of row.toggleRowSelected() doesn't help.

The error message:

Uncaught TypeError: Cannot read properties of undefined (reading 'isGrouped')
    at handleRowById (useRowSelect.js:157:1)
    at useRowSelect.js:166:1
    at Array.forEach (<anonymous>)
    at handleRowById (useRowSelect.js:166:1)
    at reducer$8 (useRowSelect.js:170:1)
    at useTable.js:124:1
    at Array.reduce (<anonymous>)
    at useTable.js:117:1
    at updateReducer (react-dom.development.js:15318:1)
    at Object.useReducer (react-dom.development.js:16425:1)
    at Object.useReducer (react.development.js:1512:1)
    at useTable (useTable.js:57:1)
    at LeftTable (index.tsx:137:1)
    at renderWithHooks (react-dom.development.js:14985:1)
    at updateFunctionComponent (react-dom.development.js:17356:1)
    at beginWork (react-dom.development.js:19063:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
    at invokeGuardedCallback (react-dom.development.js:4056:1)
    at beginWork$1 (react-dom.development.js:23964:1)
    at performUnitOfWork (react-dom.development.js:22776:1)
    at workLoopSync (react-dom.development.js:22707:1)
    at renderRootSync (react-dom.development.js:22670:1)
    at performSyncWorkOnRoot (react-dom.development.js:22293:1)
    at react-dom.development.js:11327:1
    at unstable_runWithPriority (scheduler.development.js:468:1)
    at runWithPriority$1 (react-dom.development.js:11276:1)
    at flushSyncCallbackQueueImpl (react-dom.development.js:11322:1)
    at flushSyncCallbackQueue (react-dom.development.js:11309:1)
    at discreteUpdates$1 (react-dom.development.js:22420:1)
    at discreteUpdates (react-dom.development.js:3756:1)
    at dispatchDiscreteEvent (react-dom.development.js:5889:1)

Here is the codesandbox (doesn't recreate the problem)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.