material-react-table icon indicating copy to clipboard operation
material-react-table copied to clipboard

Setting columnFilters to undefined in initialState

Open joelbong opened this issue 4 months ago • 0 comments

material-react-table version

3.0.1

react & react-dom versions

18.3.1

Describe the bug and the steps to reproduce it

When explicitly setting columnFilters in initialState to undefined, it can sometimes cause an error (though it's not consistently reproducible). The issue occurs here. To address this, either ensure that the code checks for the possibility that columnFilters can be undefined, or prevent columnFilters from being set to undefined in the initial state, as indicated by the type definition: initialState?: Partial<MRT_TableState<TData>>. While the error isn't always reproducible, I was able to replicate it in a production build using ViteJS 5.3.4.

Minimal, Reproducible Example - (Optional, but Recommended)

  1. Set columnFilters to undefined in initialState

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

Yes, I think I know how to fix it and will discuss it in the comments of this issue

Terms

  • [X] I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

joelbong avatar Oct 22 '24 10:10 joelbong