useRowSelect not work with React.StrictMode
See original GitHub issueDescribe the bug (required)
When using React.StrictMode
in conjunction with useRowSelect
, I cannot select more than one row. And in selectedRowIds I only get data from the first selection
Provide an example via Codesandbox! (required)
I fork base useRowSelect
example and add React.StrictMode
.
Exsample
Steps To Reproduce (required) 0. State before:
"selectedRowIds": {},
- Select first line.
"selectedRowIds": {
"0": true,
"0.0": true,
"0.1": true,
"0.2": true
}
- Select second line
"selectedRowIds": {
"0": true,
"0.0": true,
"0.1": true,
"0.2": true
}
- Select third line
"selectedRowIds": {
"0": true,
"0.0": true,
"0.1": true,
"0.2": true
}
Expected behavior (Recommended) 0. State before:
"selectedRowIds": {},
- Select first line.
"selectedRowIds": {
"0": true,
"0.0": true,
"0.1": true,
"0.2": true
}
- Select second line
"selectedRowIds": {
"0": true,
"1": true,
"0.0": true,
"0.1": true,
"0.2": true,
"1.0": true,
"1.1": true,
"1.2": true
},
- Select third line
{
"selectedRowIds": {
"0": true,
"1": true,
"2": true,
"0.0": true,
"0.1": true,
"0.2": true,
"1.0": true,
"1.1": true,
"1.2": true,
"2.0": true,
"2.1": true,
"2.2": true
},
Desktop (please complete the following information):
- OS: macOS 10.15.2
- Google Chrome
- Version 80.0.3987.149
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:8 (1 by maintainers)
Top Results From Across the Web
useRowSelect not work with React.StrictMode #2120 - GitHub
Describe the bug (required) When using React.StrictMode in conjunction with useRowSelect, I cannot select more than one row.
Read more >Strict Mode - React
Strict mode checks are run in development mode only; they do not impact the production build. You can enable strict mode for any...
Read more >React Table - radio input for useRowSelect - Stack Overflow
I am trying to exclusively select only 1 row at at time, and I see that your code only does this if including...
Read more >React Table Row Select Strict Mode Broken - CodeSandbox
Activating extension 'vscode.typescript-language-features' failed: Could not find bundled tsserver.js.
Read more >gettoggleallrowsselectedprops is not a function - You.com | The ...
I added a special column with checkbox, but keep getting strange error: "TypeError: props.getToggleAllRowsSelectedProps is not a function".
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here is another sandbox that shows the problem:
https://codesandbox.io/s/hopeful-elion-9ueg9?file=/src/index.js
To reproduce:
Without strict mode:
Ideas I believe this could come from either of two design issues (or the combination of both).
There are side effects in a
useMemo
hook — opened #2170 about this.The state reducer reads state outside of
previousState
, which may or may not be up to date (resolving this ambiguity is the whole point of the reducer pattern). — opened #2171 about this.Going to track this in #2170