Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

A table doesn't get updated when a defaultColumn changes

Abierto
#5,275 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

  • #6587 de @lx3133584 — cerrado sin fusionar

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
react, typescript
Área
frontend

Línea de trabajo

Comienza con el CodeSandbox proporcionado y la configuración de useReactTable, reproduciendo el cambio de un tamaño inicial de defaultColumn de 200 a 50. Lee la implementación del dimensionamiento de columnas y compara cómo se gestionan los cambios de defaultColumn con columnResizeDirection; se considera terminado cuando las columnas de la tabla renderizada reflejan el tamaño predeterminado actualizado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Describe the bug

I used one of your examples and added a defaultColumn with an initial size to the table, which works fine. However if the defaultColumn gets updated later on, this change doesn't get reflected in the actual size of the table columns.
So if we have the below code and I set the initial size to 100 and then in the useEffect I update it to 50, it will still remain 100 for the rendered table even if the table generated by the useReactTable gets the new value. I checked the same with columnResizeDirection and it works fine.

const [defaultColumn, setDefaultColumn] = React.useState({size: 200})

  React.useEffect(() => {
    setDefaultColumn({size: 50})
  }, [])

  const table = useReactTable({
    data,
    columns,
    columnResizeMode,
    defaultColumn,
    columnResizeDirection,
    getCoreRowModel: getCoreRowModel(),
    debugTable: true,
    debugHeaders: true,
    debugColumns: true,
  })
Your minimal, reproducible example

https://codesandbox.io/p/sandbox/reacttable-lycjfh

Steps to reproduce

As in description

Expected behavior

The size of the columns gets updated when the defaultColumn gets changed

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

macOS Chrome

react-table version

8.11.6

TypeScript version

4.4.2

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.5k
Forks
3.6k
Merge medio
19 h 40 min
PR fusionados (30 d)
8

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TanStack/table

Todos los issues de TanStack/table

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.