React-table: Column Hiding is broken in v7.0 RC10

Created on 16 Dec 2019  路  8Comments  路  Source: tannerlinsley/react-table

Describe the bug
Hiding columns stopped working in RC10.
What still works is adding hiddenColumns in initialState, which results in both the corresponding checkbox being unchecked and table column being hidden.

To Reproduce
Steps to reproduce the behavior:

  1. Open the default column hiding example linked below.
  2. Click "Toggle All" without previous selection, note that it crashes with the error: Uncaught TypeError: Cannot read property 'flatColumns' of undefined.
  3. Reload, this time click one of the column checkboxes first. the displayed hiddenColumns array will contain the selected entry, but the checkbox stays checked. The "Toggle All" checkbox enters an indeterminate state. Also, the actual table column is still visible.
  4. Click the same column again, instead of toggling the existing entry the same value will be applied to the array again.
  5. Click "Toggle All" with some previous selection, see how the hiddenColumns is cleared without an error thrown. The visible table state does not change.

Expected behavior

  • Clicking "Toggle All" with no selection should not result in an error.
  • Toggling a checkbox should change its checked state.
  • Toggling a checkbox should not result in the value being appended to the array multiple times.
  • An entry in the hiddenColumns array in state should result in the table columns actually reflecting these values.

Codesandbox
The existing column hiding example stopped working:
https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/column-hiding

Most helpful comment

Thanks. I'll have a fix out asap.

All 8 comments

Thanks. I'll have a fix out asap.

@tannerlinsley Updating to the latest rc.12 or rc.11 that were releases since does not seem to fix this.
What notably changes is, that "Toggle all" doesn't make the table crash anymore.

Yeah. Still working on a fix here. Hang tight

No pressure, just making sure it wasn't overlooked somehow, thanks for responding so fast :)

Fix is out in RC.13!

Great!

@tannerlinsley I wanted to give some positive Feedback, there is a great performance improvement that I could notice when hiding/showing columns now. ( probably due to the changes in RC.10?)
In a table with 50 rows I can already see a great difference with RC.13 compared to RC.9 before.

Thanks for your outstanding work!

Thanks! It was challenging, but the perf ended up being way better after some tweaks to the architecture. As always, if you are enjoying the library and have the means, consider becoming a Github Sponsor (or even better, getting your company to do it!)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pasichnyk picture pasichnyk  路  3Comments

tremby picture tremby  路  3Comments

mlajszczak picture mlajszczak  路  3Comments

alexanderwhatley picture alexanderwhatley  路  3Comments

DaveyEdwards picture DaveyEdwards  路  3Comments