custom Data within expanding example Crashing browser
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- react, typescript
- Área
- frontend
Línea de trabajo
Ejecuta el CodeSandbox enlazado y compara la versión funcional con useState con la versión que pasa los datos personalizados directamente a useReactTable. Empieza por la estructura de los datos, getSubRows y la configuración del ejemplo de expanding. Se considera completado cuando los datos anidados personalizados ya no provocan el bloqueo del navegador y el comportamiento de la tabla expanding sigue siendo utilizable.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
Hi,
I've taken this example: https://tanstack.com/table/v8/docs/examples/react/expanding
Removed things like the search filter and some extra debug but beside that I didn't change how expanding works.
For testing purposes I went and made my own data. A simple json and to be as close to the example as possible I print out data and put that in its own object and removed the useState data and I'm just passing the object with its subRows directly to useReactTable. When doing that the browser will crash. I'm brand new to TanStack and may not be understanding how subRows works but I feel like this shouldn't be crashing when I pass it the object when all it takes is any[](Ideally this should thrown an error but not sure where it's getting stuck in almost a loop, this is an assumption).
This however, does not crash if I pass the object to the useState(initialize).
Here is the sandbox
To be more specific, in the sandbox I have where it works and where it doesn't. To highlight where it doesn't:
const data = [
{
"firstName": "Daryl",
"lastName": "Rutherford",
"age": 15,
"visits": 945,
"progress": 46,
"status": "single",
"subRows": [
{
"firstName": "Kobe",
"lastName": "Lakin",
"age": 20,
"visits": 308,
"progress": 19,
"status": "single",
"subRows": [
{
"firstName": "Edyth",
"lastName": "Klocko",
"age": 38,
"visits": 362,
"progress": 29,
"status": "single"
},
{
"firstName": "Alayna",
"lastName": "Stroman",
"age": 11,
"visits": 120,
"progress": 25,
"status": "single"
},
{
"firstName": "Carolyn",
"lastName": "Rowe-Hammes",
"age": 14,
"visits": 14,
"progress": 77,
"status": "relationship"
}
]
},
{
"firstName": "Cassandre",
"lastName": "Hudson",
"age": 27,
"visits": 488,
"progress": 65,
"status": "relationship",
"subRows": [
{
"firstName": "Cade",
"lastName": "Hartmann-Effertz",
"age": 22,
"visits": 901,
"progress": 93,
"status": "single"
},
{
"firstName": "Pietro",
"lastName": "Yost",
"age": 7,
"visits": 731,
"progress": 99,
"status": "complicated"
},
{
"firstName": "Payton",
"lastName": "Kessler",
"age": 26,
"visits": 851,
"progress": 83,
"status": "complicated"
}
]
},
{
"firstName": "Nels",
"lastName": "Kunde",
"age": 6,
"visits": 307,
"progress": 52,
"status": "complicated",
"subRows": [
{
"firstName": "Nikki",
"lastName": "Hackett",
"age": 9,
"visits": 518,
"progress": 44,
"status": "single"
},
{
"firstName": "Cornell",
"lastName": "Gulgowski",
"age": 27,
"visits": 810,
"progress": 60,
"status": "complicated"
},
{
"firstName": "Jordan",
"lastName": "Bode",
"age": 26,
"visits": 15,
"progress": 93,
"status": "relationship"
}
]
},
{
"firstName": "Alberta",
"lastName": "Heaney",
"age": 20,
"visits": 15,
"progress": 57,
"status": "complicated",
"subRows": [
{
"firstName": "Braxton",
"lastName": "Kuvalis",
"age": 11,
"visits": 366,
"progress": 93,
"status": "relationship"
},
{
"firstName": "Elyssa",
"lastName": "Rolfson",
"age": 30,
"visits": 144,
"progress": 39,
"status": "relationship"
},
{
"firstName": "Jennyfer",
"lastName": "Altenwerth",
"age": 28,
"visits": 200,
"progress": 30,
"status": "single"
}
]
},
{
"firstName": "Bertrand",
"lastName": "Shields",
"age": 40,
"visits": 733,
"progress": 20,
"status": "complicated",
"subRows": [
{
"firstName": "Liliane",
"lastName": "Hudson",
"age": 38,
"visits": 649,
"progress": 85,
"status": "single"
},
{
"firstName": "Jevon",
"lastName": "Lemke",
"age": 32,
"visits": 5,
"progress": 89,
"status": "relationship"
},
{
"firstName": "Donavon",
"lastName": "Zemlak",
"age": 11,
"visits": 20,
"progress": 62,
"status": "complicated"
}
]
}
]
}
]
const table = useReactTable({
data,
columns,
state: {
expanded,
},
onExpandedChange: setExpanded,
getSubRows: row => row.subRows,
getCoreRowModel: getCoreRowModel(),
getPaginationRowModel: getPaginationRowModel(),
getFilteredRowModel: getFilteredRowModel(),
getExpandedRowModel: getExpandedRowModel(),
debugTable: true,
})
// etc .....
Your minimal, reproducible example
Steps to reproduce
- Uncomment Line 302 - 483 and comment out 117-299
Expected behavior
I expect it to work because I'm still passing an array. But if this isn't correct then I'd expect an error.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Linux & codesandbox
react-table version
8.10.7
TypeScript version
4.8.4
Additional context
No response
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
- Lenguaje dominante
- TypeScript
- Estrellas
- 28.4k
- Forks
- 3.6k
- Merge medio
- 1 d 14 h
- PR fusionados (30 d)
- 4
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/table
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 78/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Todos los issues de TanStack/table
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
security
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
IBM/node-sdk-core#373 ·
-
e2e-failure ready-to-code
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
chore
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100