T
TanStack5mo ago
subsequent-cyan

Row selection bug fixed when removing StrictMode?

A potential bug or am I doing something wrong?
const selectRow = (row) => {
if (!table.getIsSomeRowsSelected()) {
return true;
} else {
return false;
}
};

const table = useReactTable({
data: account.transactions,
columns,
getCoreRowModel: getCoreRowModel(),
enableRowSelection: selectRow,
});
const selectRow = (row) => {
if (!table.getIsSomeRowsSelected()) {
return true;
} else {
return false;
}
};

const table = useReactTable({
data: account.transactions,
columns,
getCoreRowModel: getCoreRowModel(),
enableRowSelection: selectRow,
});
"dependencies": {
"@hookform/resolvers": "^3.9.1",
"@reduxjs/toolkit": "^2.3.0",
"@tanstack/react-table": "^8.21.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"date-fns": "^3.6.0",
"immer": "^10.1.1",
"lucide-react": "^0.460.0",
"react": "^18.3.1",
"react-day-picker": "^8.10.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.53.2",
"react-icons": "^5.3.0",
"react-redux": "^9.1.2",
"react-router-dom": "^6.28.0",
"sonner": "^1.7.0",
"tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8"
},
"devDependencies": {
"@vitejs/plugin-react": "^4.3.3",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/ui": "^2.1.8",
"autoprefixer": "^10.4.20",
"eslint": "^9.13.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.13",
"globals": "^15.11.0",
"jsdom": "^24.1.3",
"postcss": "^8.4.47",
"redux-mock-store": "^1.5.5",
"tailwindcss": "^3.4.14",
"typescript": "~5.6.2",
"typescript-eslint": "^8.10.0",
"vite": "^5.4.9",
"vitest": "^2.1.8"
}
"dependencies": {
"@hookform/resolvers": "^3.9.1",
"@reduxjs/toolkit": "^2.3.0",
"@tanstack/react-table": "^8.21.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"date-fns": "^3.6.0",
"immer": "^10.1.1",
"lucide-react": "^0.460.0",
"react": "^18.3.1",
"react-day-picker": "^8.10.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.53.2",
"react-icons": "^5.3.0",
"react-redux": "^9.1.2",
"react-router-dom": "^6.28.0",
"sonner": "^1.7.0",
"tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8"
},
"devDependencies": {
"@vitejs/plugin-react": "^4.3.3",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/ui": "^2.1.8",
"autoprefixer": "^10.4.20",
"eslint": "^9.13.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.13",
"globals": "^15.11.0",
"jsdom": "^24.1.3",
"postcss": "^8.4.47",
"redux-mock-store": "^1.5.5",
"tailwindcss": "^3.4.14",
"typescript": "~5.6.2",
"typescript-eslint": "^8.10.0",
"vite": "^5.4.9",
"vitest": "^2.1.8"
}
"@tanstack/react-table": "^8.21.2",
"@tanstack/react-table": "^8.21.2",
I'm never able to select a row, removing StrictMode fixes this, console.log of table.getIsSomeRowsSelected() in selectRow returns this on every row click:
No description
1 Reply
subsequent-cyan
subsequent-cyanOP5mo ago
Here is an example: https://codesandbox.io/p/devbox/runtime-shadow-4wgswn?workspaceId=ws_DZLaj6iS7KgUGfrov7xT19 removing StrictMode allows selection as expected

Did you find this page helpful?